Compare commits
6 Commits
9e082aa795
...
e15312ced5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e15312ced5 | ||
f02a6b6a3d | |||
efb5cf64f5 | |||
9a99981f67 | |||
9e9ee0c995 | |||
82a39bce82 |
@ -6,6 +6,9 @@ require 'csv'
|
||||
|
||||
class GuestsController < ApplicationController
|
||||
GUEST_PARAMS = { only: %i[id name status], include: { group: { only: %i[id name] } } }.freeze
|
||||
|
||||
skip_before_action :authenticate_user!, only: :update
|
||||
|
||||
def index
|
||||
render json: Guest.includes(:group)
|
||||
.left_joins(:group)
|
||||
@ -31,6 +34,6 @@ class GuestsController < ApplicationController
|
||||
private
|
||||
|
||||
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
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
||||
|
||||
class InvitationsController < ApplicationController
|
||||
skip_before_action :authenticate_user!, only: :show
|
||||
|
||||
def index
|
||||
render json: Invitation.includes(:guests).as_json(
|
||||
only: :id,
|
||||
@ -16,6 +16,16 @@ class InvitationsController < ApplicationController
|
||||
)
|
||||
end
|
||||
|
||||
def show
|
||||
invitation = Invitation.includes(:guests).find(params[:id])
|
||||
|
||||
if invitation
|
||||
render json: invitation, only: :id, include: { guests: { only: %i[id name status] } }, status: :ok
|
||||
else
|
||||
render json: { error: 'Invitation not found' }, status: :not_found
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
invitation = Invitation.create
|
||||
|
||||
|
@ -42,7 +42,7 @@ Rails.application.routes.draw do
|
||||
|
||||
resources :tables_arrangements, only: %i[index show create]
|
||||
resources :summary, only: :index
|
||||
resources :invitations, only: %i[index create update destroy]
|
||||
resources :invitations, only: %i[show index create update destroy]
|
||||
|
||||
root to: redirect("/%{slug}")
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user