Merge pull request 'Allow the creation of guests associated to no group' (#174) from allow-creation-groupless-guests into main
Reviewed-on: #174
This commit is contained in:
		
						commit
						b38e845b90
					
				| @ -5,7 +5,7 @@ require 'csv' | |||||||
| class GuestsController < ApplicationController | class GuestsController < ApplicationController | ||||||
|   def index |   def index | ||||||
|     render json: Guest.all.includes(:group) |     render json: Guest.all.includes(:group) | ||||||
|                       .joins(:group) |                       .left_joins(:group) | ||||||
|                       .order('groups.name' => :asc, name: :asc) |                       .order('groups.name' => :asc, name: :asc) | ||||||
|                       .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) |                       .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) | ||||||
|   end |   end | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ | |||||||
| # | # | ||||||
| class Guest < ApplicationRecord | class Guest < ApplicationRecord | ||||||
|   acts_as_tenant :wedding |   acts_as_tenant :wedding | ||||||
|   belongs_to :group |   belongs_to :group, optional: true | ||||||
| 
 | 
 | ||||||
|   enum :status, { |   enum :status, { | ||||||
|     considered: 0, |     considered: 0, | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ RSpec.describe Guest, type: :model do | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   it { should belong_to(:group) } |   it { should belong_to(:group).optional } | ||||||
| 
 | 
 | ||||||
|   describe 'scopes' do |   describe 'scopes' do | ||||||
|     describe '.potential' do |     describe '.potential' do | ||||||
|  | |||||||
| @ -41,7 +41,7 @@ RSpec.describe 'guests', type: :request do | |||||||
|         properties: { |         properties: { | ||||||
|           guest: { |           guest: { | ||||||
|             type: :object, |             type: :object, | ||||||
|             required: %i[name group_id status], |             required: %i[name status], | ||||||
|             properties: { |             properties: { | ||||||
|               name: { type: :string }, |               name: { type: :string }, | ||||||
|               group_id: { type: :string, format: :uuid }, |               group_id: { type: :string, format: :uuid }, | ||||||
| @ -70,6 +70,7 @@ RSpec.describe 'guests', type: :request do | |||||||
|         properties: { |         properties: { | ||||||
|           guest: { |           guest: { | ||||||
|             type: :object, |             type: :object, | ||||||
|  |             required: %i[name status], | ||||||
|             properties: { |             properties: { | ||||||
|               name: { type: :string }, |               name: { type: :string }, | ||||||
|               group_id: { type: :string, format: :uuid }, |               group_id: { type: :string, format: :uuid }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user