Define a new public endpoint to get information about an invitation
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 40s
Run unit tests / rubocop (pull_request) Successful in 52s
Run unit tests / check-licenses (pull_request) Successful in 56s
Run unit tests / unit_tests (pull_request) Successful in 1m38s
Run unit tests / build-static-assets (pull_request) Successful in 8m29s
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 40s
Run unit tests / rubocop (pull_request) Successful in 52s
Run unit tests / check-licenses (pull_request) Successful in 56s
Run unit tests / unit_tests (pull_request) Successful in 1m38s
Run unit tests / build-static-assets (pull_request) Successful in 8m29s
This commit is contained in:
parent
d953e7c4a2
commit
82a39bce82
@ -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: :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