Skip to content

Commit

Permalink
Add endpoint to create skills
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandromontividiu03 committed Oct 22, 2024
1 parent d968307 commit fdbb97c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/controllers/skills_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# frozen_string_literal: true

class SkillsController < ApplicationController

def index
@skills = Skill.all
@skills = Skill.all.sort_by(&:name)
end

def create
@skill = Skill.new(skill_params)

if @skill.save
render json: @skill, status: :created, location: @skill
render json: @skill, status: :created
else
render json: @skill.errors, status: :unprocessable_entity
end
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
resources :users
resources :customers
resources :professions, only: [:index]
resources :skills, only: [:index]
resources :skills, only: [:index, :create]
resources :issues, only: [:index]
resources :permissions, only: [:index]
resources :user_skills, only: [:index] do
Expand Down

0 comments on commit fdbb97c

Please sign in to comment.