Merge pull request 'Allow the creation of guests associated to no group' (#174) from allow-creation-groupless-guests into main
All checks were successful
Check usage of free licenses / check-licenses (push) Successful in 1m1s
Run unit tests / unit_tests (push) Successful in 2m57s
Build Nginx-based docker image / build-static-assets (push) Successful in 23m24s

Reviewed-on: #174
This commit is contained in:
bustikiller 2024-12-08 12:13:03 +00:00
commit b38e845b90
4 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ require 'csv'
class GuestsController < ApplicationController
def index
render json: Guest.all.includes(:group)
.joins(:group)
.left_joins(:group)
.order('groups.name' => :asc, name: :asc)
.as_json(only: %i[id name status], include: { group: { only: %i[id name] } })
end

View File

@ -25,7 +25,7 @@
#
class Guest < ApplicationRecord
acts_as_tenant :wedding
belongs_to :group
belongs_to :group, optional: true
enum :status, {
considered: 0,

View File

@ -16,7 +16,7 @@ RSpec.describe Guest, type: :model do
end
end
it { should belong_to(:group) }
it { should belong_to(:group).optional }
describe 'scopes' do
describe '.potential' do

View File

@ -41,7 +41,7 @@ RSpec.describe 'guests', type: :request do
properties: {
guest: {
type: :object,
required: %i[name group_id status],
required: %i[name status],
properties: {
name: { type: :string },
group_id: { type: :string, format: :uuid },
@ -70,6 +70,7 @@ RSpec.describe 'guests', type: :request do
properties: {
guest: {
type: :object,
required: %i[name status],
properties: {
name: { type: :string },
group_id: { type: :string, format: :uuid },