2024-10-27 21:42:45 +00:00
|
|
|
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
|
2024-11-13 08:12:46 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: guests
|
|
|
|
#
|
|
|
|
# id :uuid not null, primary key
|
|
|
|
# name :string
|
|
|
|
# phone :string
|
|
|
|
# status :integer default("considered")
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
# group_id :uuid not null
|
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
|
|
|
# index_guests_on_group_id (group_id)
|
|
|
|
#
|
|
|
|
# Foreign Keys
|
|
|
|
#
|
|
|
|
# fk_rails_... (group_id => groups.id)
|
|
|
|
#
|
2024-07-11 20:08:26 +02:00
|
|
|
class Guest < ApplicationRecord
|
2024-08-11 18:25:12 +02:00
|
|
|
belongs_to :group
|
2024-08-11 19:24:24 +02:00
|
|
|
|
2024-11-09 17:45:23 +01:00
|
|
|
enum :status, {
|
2024-08-11 19:24:24 +02:00
|
|
|
considered: 0,
|
|
|
|
invited: 10,
|
|
|
|
confirmed: 20,
|
2024-10-27 19:25:24 +01:00
|
|
|
declined: 30,
|
2024-11-03 09:15:48 +01:00
|
|
|
tentative: 40
|
2024-08-11 19:24:24 +02:00
|
|
|
}
|
|
|
|
|
2024-11-03 09:15:48 +01:00
|
|
|
scope :potential, -> { where.not(status: %i[declined considered]) }
|
2024-07-11 20:08:26 +02:00
|
|
|
end
|