Include confirmation status
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Run unit tests / unit_tests (pull_request) Successful in 2m39s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Run unit tests / unit_tests (pull_request) Successful in 2m39s
				
			This commit is contained in:
		
							parent
							
								
									c177131672
								
							
						
					
					
						commit
						cb42b86136
					
				| @ -1,6 +1,14 @@ | |||||||
| class Guest < ApplicationRecord | class Guest < ApplicationRecord | ||||||
|   acts_as_taggable_on :affinity_groups, :unbreakable_bonds |   acts_as_taggable_on :affinity_groups, :unbreakable_bonds | ||||||
|   belongs_to :group |   belongs_to :group | ||||||
|  | 
 | ||||||
|  |   enum status: { | ||||||
|  |     considered: 0, | ||||||
|  |     invited: 10, | ||||||
|  |     confirmed: 20, | ||||||
|  |     declined: 30 | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   def full_name |   def full_name | ||||||
|     "#{first_name} #{last_name}" |     "#{first_name} #{last_name}" | ||||||
|   end |   end | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| class SerializableGuest < JSONAPI::Serializable::Resource | class SerializableGuest < JSONAPI::Serializable::Resource | ||||||
|   type 'guest' |   type 'guest' | ||||||
| 
 | 
 | ||||||
|   attributes :id, :email, :group_id |   attributes :id, :email, :group_id, :status | ||||||
| 
 | 
 | ||||||
|   attribute :name do |   attribute :name do | ||||||
|     "#{@object.first_name} #{@object.last_name}" |     "#{@object.first_name} #{@object.last_name}" | ||||||
| @ -10,4 +10,8 @@ class SerializableGuest < JSONAPI::Serializable::Resource | |||||||
|   attribute :group_name do |   attribute :group_name do | ||||||
|     @object.group.name |     @object.group.name | ||||||
|   end |   end | ||||||
|  | 
 | ||||||
|  |   attribute :status do | ||||||
|  |     @object.status.capitalize | ||||||
|  |   end | ||||||
| end | end | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								db/migrate/20240811170021_add_status_to_guest.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								db/migrate/20240811170021_add_status_to_guest.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | class AddStatusToGuest < ActiveRecord::Migration[7.1] | ||||||
|  |   def change | ||||||
|  |     add_column :guests, :status, :integer, default: 0 | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										3
									
								
								db/schema.rb
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								db/schema.rb
									
									
									
										generated
									
									
									
								
							| @ -10,7 +10,7 @@ | |||||||
| # | # | ||||||
| # It's strongly recommended that you check this file into your version control system. | # It's strongly recommended that you check this file into your version control system. | ||||||
| 
 | 
 | ||||||
| ActiveRecord::Schema[7.1].define(version: 2024_08_11_154115) do | ActiveRecord::Schema[7.1].define(version: 2024_08_11_170021) do | ||||||
|   # These are extensions that must be enabled in order to support this database |   # These are extensions that must be enabled in order to support this database | ||||||
|   enable_extension "plpgsql" |   enable_extension "plpgsql" | ||||||
| 
 | 
 | ||||||
| @ -45,6 +45,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_08_11_154115) do | |||||||
|     t.datetime "created_at", null: false |     t.datetime "created_at", null: false | ||||||
|     t.datetime "updated_at", null: false |     t.datetime "updated_at", null: false | ||||||
|     t.uuid "group_id", null: false |     t.uuid "group_id", null: false | ||||||
|  |     t.integer "status", default: 0 | ||||||
|     t.index ["group_id"], name: "index_guests_on_group_id" |     t.index ["group_id"], name: "index_guests_on_group_id" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -60,6 +60,7 @@ NUMBER_OF_GUESTS.times do | |||||||
|     last_name: Faker::Name.last_name, |     last_name: Faker::Name.last_name, | ||||||
|     email: Faker::Internet.email, |     email: Faker::Internet.email, | ||||||
|     phone: Faker::PhoneNumber.cell_phone, |     phone: Faker::PhoneNumber.cell_phone, | ||||||
|     group: groups.sample |     group: groups.sample, | ||||||
|  |     status: Guest.statuses.keys.sample | ||||||
|   ) |   ) | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user