Merge pull request 'Allow updating the status of guests from unauthenticated sessions' (#280) from guest-update-from-invitation into main
All checks were successful
Run unit tests / rubocop (push) Has been skipped
Run unit tests / check-licenses (push) Has been skipped
Run unit tests / copyright_notice (push) Has been skipped
Run unit tests / unit_tests (push) Successful in 54s
Run unit tests / build-static-assets (push) Successful in 8m32s
All checks were successful
Run unit tests / rubocop (push) Has been skipped
Run unit tests / check-licenses (push) Has been skipped
Run unit tests / copyright_notice (push) Has been skipped
Run unit tests / unit_tests (push) Successful in 54s
Run unit tests / build-static-assets (push) Successful in 8m32s
Reviewed-on: #280
This commit is contained in:
commit
f02a6b6a3d
@ -6,6 +6,9 @@ require 'csv'
|
|||||||
|
|
||||||
class GuestsController < ApplicationController
|
class GuestsController < ApplicationController
|
||||||
GUEST_PARAMS = { only: %i[id name status], include: { group: { only: %i[id name] } } }.freeze
|
GUEST_PARAMS = { only: %i[id name status], include: { group: { only: %i[id name] } } }.freeze
|
||||||
|
|
||||||
|
skip_before_action :authenticate_user!, only: :update
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render json: Guest.includes(:group)
|
render json: Guest.includes(:group)
|
||||||
.left_joins(:group)
|
.left_joins(:group)
|
||||||
@ -31,6 +34,6 @@ class GuestsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def guest_params
|
def guest_params
|
||||||
params.expect(guest: %i[name group_id status])
|
user_signed_in? ? params.expect(guest: %i[name group_id status]) : params.expect(guest: %i[status])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,7 +20,7 @@ class InvitationsController < ApplicationController
|
|||||||
invitation = Invitation.includes(:guests).find(params[:id])
|
invitation = Invitation.includes(:guests).find(params[:id])
|
||||||
|
|
||||||
if invitation
|
if invitation
|
||||||
render json: invitation, only: :id, include: { guests: { only: %i[id name] } }, status: :ok
|
render json: invitation, only: :id, include: { guests: { only: %i[id name status] } }, status: :ok
|
||||||
else
|
else
|
||||||
render json: { error: 'Invitation not found' }, status: :not_found
|
render json: { error: 'Invitation not found' }, status: :not_found
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user