Manuel Bustillo 6f6a6aaabf
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 4m31s
Add copyright notice / copyright_notice (pull_request) Successful in 18m9s
Run unit tests / unit_tests (pull_request) Successful in 17m2s
Update format of guests API and document endpoints
2024-11-16 02:16:19 +01:00

38 lines
770 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
# == 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)
#
class Guest < ApplicationRecord
belongs_to :group
enum :status, {
considered: 0,
invited: 10,
confirmed: 20,
declined: 30,
tentative: 40
}, validate: true
validates :name, presence: true
scope :potential, -> { where.not(status: %i[declined considered]) }
end