Compare commits
6 Commits
9e082aa795
...
e15312ced5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e15312ced5 | ||
f02a6b6a3d | |||
efb5cf64f5 | |||
9a99981f67 | |||
9e9ee0c995 | |||
82a39bce82 |
2
Gemfile
2
Gemfile
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '3.4.3'
|
ruby '3.4.4'
|
||||||
gem 'bootsnap', require: false
|
gem 'bootsnap', require: false
|
||||||
gem 'csv'
|
gem 'csv'
|
||||||
gem 'importmap-rails'
|
gem 'importmap-rails'
|
||||||
|
@ -634,7 +634,7 @@ CHECKSUMS
|
|||||||
zeitwerk (2.7.3) sha256=b2e86b4a9b57d26ba68a15230dcc7fe6f040f06831ce64417b0621ad96ba3e85
|
zeitwerk (2.7.3) sha256=b2e86b4a9b57d26ba68a15230dcc7fe6f040f06831ce64417b0621ad96ba3e85
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 3.4.3p32
|
ruby 3.4.4p34
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.6.1
|
2.6.1
|
||||||
|
@ -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
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
|
||||||
|
|
||||||
class InvitationsController < ApplicationController
|
class InvitationsController < ApplicationController
|
||||||
|
skip_before_action :authenticate_user!, only: :show
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render json: Invitation.includes(:guests).as_json(
|
render json: Invitation.includes(:guests).as_json(
|
||||||
only: :id,
|
only: :id,
|
||||||
@ -16,6 +16,16 @@ class InvitationsController < ApplicationController
|
|||||||
)
|
)
|
||||||
end
|
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
|
def create
|
||||||
invitation = Invitation.create
|
invitation = Invitation.create
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :tables_arrangements, only: %i[index show create]
|
resources :tables_arrangements, only: %i[index show create]
|
||||||
resources :summary, only: :index
|
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}")
|
root to: redirect("/%{slug}")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user