diff --git a/app/controllers/bookings_controller.rb b/app/controllers/bookings_controller.rb index d814e87..39e3be9 100644 --- a/app/controllers/bookings_controller.rb +++ b/app/controllers/bookings_controller.rb @@ -55,7 +55,17 @@ def booking_params :assistance_donate, :assistance_claim, :single_person, - :dog) + :dog, + :lark_or_owl, + :massage_house, + :late_n_loud, + :chillout_house, + :dog_house, + :hot_tub_house, + :family_room, + :sharing_with, + :sharing_bed, + :comments) end def new_booking @@ -67,6 +77,17 @@ def new_booking assistance_donate: params[:booking][:assistance_donate], assistance_claim: params[:booking][:assistance_claim], single_person: params[:booking][:single_person], - dog: params[:booking][:dog]) + dog: params[:booking][:dog], + lark_or_owl: params[:booking][:lark_or_owl], + massage_house: params[:booking][:massage_house], + late_n_loud: params[:booking][:late_n_loud], + chillout_house: params[:booking][:chillout_house], + dog_house: params[:booking][:dog_house], + hot_tub_house: params[:booking][:hot_tub_house], + family_room: params[:booking][:family_room], + sharing_with: params[:booking][:sharing_with], + sharing_bed: params[:booking][:sharing_bed], + comments: params[:booking][:comments] + ) end end diff --git a/app/models/booking.rb b/app/models/booking.rb index d6f13e0..23eeaf9 100644 --- a/app/models/booking.rb +++ b/app/models/booking.rb @@ -4,5 +4,6 @@ class Booking < ApplicationRecord belongs_to :user belongs_to :event - validates :arrival, :departure, :cancellable, :assistance_claim, :single_person, :dog, presence: true + validates :arrival, :departure, :cancellable, :assistance_claim, :single_person, :dog, :lark_or_owl, :massage_house, + :late_n_loud, :chillout_house, :dog_house, :hot_tub_house, :family_room, presence: true end diff --git a/db/migrate/20241117164534_add_requests_to_bookings.rb b/db/migrate/20241117164534_add_requests_to_bookings.rb new file mode 100644 index 0000000..99c0d22 --- /dev/null +++ b/db/migrate/20241117164534_add_requests_to_bookings.rb @@ -0,0 +1,22 @@ +class AddRequestsToBookings < ActiveRecord::Migration[7.1] + def change + create_enum :lark_or_owl, ["lark", "owl", "neither"] + create_enum :massage_house, ["yes", "no", "don't mind"] + create_enum :late_n_loud, ["yes", "no", "don't mind"] + create_enum :chillout_house, ["yes", "no", "don't mind"] + create_enum :hot_tub_house, ["yes", "no", "don't mind"] + create_enum :sharing_bed, ["double", "two singles"] + create_enum :dog_house, ["yes", "no", "don't mind"] + + add_column :bookings, :lark_or_owl, :enum, enum_type: :lark_or_owl, null: false + add_column :bookings, :massage_house, :enum, enum_type: :massage_house, null: false + add_column :bookings, :late_n_loud, :enum, enum_type: :late_n_loud, null: false + add_column :bookings, :chillout_house, :enum, enum_type: :chillout_house, null: false + add_column :bookings, :dog_house, :enum, enum_type: :dog_house, null: false + add_column :bookings, :hot_tub_house, :enum, enum_type: :hot_tub_house, null: false + add_column :bookings, :family_room, :boolean + add_column :bookings, :sharing_with, :string + add_column :bookings, :sharing_bed, :enum, enum_type: :sharing_bed + add_column :bookings, :comments, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 72ee567..6ada847 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_11_17_160817) do +ActiveRecord::Schema[7.1].define(version: 2024_11_17_164534) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -19,6 +19,13 @@ # Note that some types may not work with other database engines. Be careful if changing database. create_enum "assistance_claim", ["yes", "no"] create_enum "cancellable", ["yes", "no"] + create_enum "chillout_house", ["yes", "no", "don't mind"] + create_enum "dog_house", ["yes", "no", "don't mind"] + create_enum "hot_tub_house", ["yes", "no", "don't mind"] + create_enum "lark_or_owl", ["lark", "owl", "neither"] + create_enum "late_n_loud", ["yes", "no", "don't mind"] + create_enum "massage_house", ["yes", "no", "don't mind"] + create_enum "sharing_bed", ["double", "two singles"] create_enum "single_person", ["yes", "no"] create_table "bookings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -33,6 +40,16 @@ t.enum "cancellable", null: false, enum_type: "cancellable" t.enum "assistance_claim", null: false, enum_type: "assistance_claim" t.enum "single_person", null: false, enum_type: "single_person" + t.enum "lark_or_owl", null: false, enum_type: "lark_or_owl" + t.enum "massage_house", null: false, enum_type: "massage_house" + t.enum "late_n_loud", null: false, enum_type: "late_n_loud" + t.enum "chillout_house", null: false, enum_type: "chillout_house" + t.enum "dog_house", null: false, enum_type: "dog_house" + t.enum "hot_tub_house", null: false, enum_type: "hot_tub_house" + t.boolean "family_room" + t.string "sharing_with" + t.enum "sharing_bed", enum_type: "sharing_bed" + t.string "comments" t.index ["event_id"], name: "index_bookings_on_event_id" t.index ["user_id"], name: "index_bookings_on_user_id" end