Merge pull request 'Refine guest controller' (#140) from refine-guest-controller into main
Reviewed-on: #140
This commit is contained in:
commit
300524956b
@ -11,12 +11,12 @@ class GuestsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
Guest.create!(params.require(:guest).permit(:name, :group_id, :status))
|
||||
Guest.create!(guest_params)
|
||||
render json: {}, status: :created
|
||||
end
|
||||
|
||||
def update
|
||||
Guest.find(params[:id]).update!(params.require(:guest).permit(:name, :status))
|
||||
Guest.find(params[:id]).update!(guest_params)
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
|
||||
@ -24,4 +24,10 @@ class GuestsController < ApplicationController
|
||||
Guest.find(params[:id]).destroy!
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def guest_params
|
||||
params.require(:guest).permit(:name, :group_id, :status)
|
||||
end
|
||||
end
|
||||
|
@ -67,6 +67,7 @@ RSpec.describe 'guests', type: :request do
|
||||
type: :object,
|
||||
properties: {
|
||||
name: { type: :string },
|
||||
group_id: { type: :string, format: :uuid },
|
||||
status: { type: :string, enum: Guest.statuses.keys }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user