Compare commits

..

5 Commits

Author SHA1 Message Date
d1791e12c7 Merge pull request 'Do not require authentication to access the public website content' (#274) from public-access-website into main
Some checks failed
Run unit tests / rubocop (push) Failing after 30s
Run unit tests / check-licenses (push) Successful in 32s
Run unit tests / copyright_notice (push) Successful in 45s
Run unit tests / unit_tests (push) Successful in 1m27s
Run unit tests / build-static-assets (push) Has been skipped
Reviewed-on: #274
2025-06-09 06:35:59 +00:00
3832f1d840 Do not require authentication to access the public website content
All checks were successful
Run unit tests / check-licenses (pull_request) Successful in 40s
Run unit tests / rubocop (pull_request) Successful in 42s
Run unit tests / copyright_notice (pull_request) Successful in 53s
Run unit tests / unit_tests (pull_request) Successful in 1m23s
Run unit tests / build-static-assets (pull_request) Successful in 8m0s
2025-06-09 08:26:26 +02:00
4e2d046b18 Merge pull request 'Store website content as HTML' (#273) from store-website into main
All checks were successful
Run unit tests / rubocop (push) Successful in 45s
Run unit tests / check-licenses (push) Successful in 47s
Run unit tests / copyright_notice (push) Successful in 1m14s
Run unit tests / unit_tests (push) Successful in 3m45s
Run unit tests / build-static-assets (push) Successful in 15m46s
Reviewed-on: #273
2025-06-08 21:35:43 +00:00
c0ba659f29 Merge pull request 'Return guest that has just been created' (#272) from api/return-guest into main
Some checks failed
Run unit tests / rubocop (push) Successful in 41s
Run unit tests / check-licenses (push) Successful in 53s
Run unit tests / copyright_notice (push) Successful in 1m8s
Run unit tests / unit_tests (push) Successful in 3m2s
Run unit tests / build-static-assets (push) Has been cancelled
Reviewed-on: #272
2025-06-08 21:31:40 +00:00
4a107d6728 Return guest that has just been created
All checks were successful
Run unit tests / copyright_notice (pull_request) Successful in 40s
Run unit tests / rubocop (pull_request) Successful in 1m2s
Run unit tests / unit_tests (pull_request) Successful in 1m39s
Run unit tests / check-licenses (pull_request) Successful in 34s
Run unit tests / build-static-assets (pull_request) Successful in 21m2s
2025-06-08 17:38:34 +02:00
3 changed files with 9 additions and 10 deletions

View File

@ -5,21 +5,22 @@
require 'csv'
class GuestsController < ApplicationController
GUEST_PARAMS = { only: %i[id name status], include: { group: { only: %i[id name] } } }.freeze
def index
render json: Guest.includes(:group)
.left_joins(:group)
.order('groups.name' => :asc, name: :asc)
.as_json(only: %i[id name status], include: { group: { only: %i[id name] } })
.as_json(GUEST_PARAMS)
end
def create
Guest.create!(guest_params)
render json: {}, status: :created
guest = Guest.create!(guest_params)
render json: guest.as_json(GUEST_PARAMS), status: :created
end
def update
Guest.find(params[:id]).update!(guest_params)
render json: {}, status: :ok
guest = Guest.find(params[:id]).update!(guest_params)
render json: guest.as_json(GUEST_PARAMS), status: :ok
end
def destroy

View File

@ -3,6 +3,8 @@
# frozen_string_literal: true
class WebsitesController < ApplicationController
skip_before_action :authenticate_user!, only: :show
def show
render json: current_tenant.website.as_json(only: %i[content]) || {}, status: :ok
end

View File

@ -5,16 +5,12 @@
class SerializableGuest < JSONAPI::Serializable::Resource
type 'guest'
attributes :id, :group_id, :status
attributes :id, :status
attribute :name do
@object.name
end
attribute :group_name do
@object.group.name
end
attribute :status do
@object.status.capitalize
end