2022-12-28 17:51:27 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-01-11 17:32:16 +01:00
|
|
|
require_relative 'cart_item'
|
|
|
|
|
2022-12-28 17:51:27 +01:00
|
|
|
# A relation table between a pending reservation and a slot
|
|
|
|
class CartItem::ReservationSlot < ApplicationRecord
|
2023-01-11 17:32:16 +01:00
|
|
|
self.table_name = 'cart_item_reservation_slots'
|
|
|
|
|
2022-12-28 17:51:27 +01:00
|
|
|
belongs_to :cart_item, polymorphic: true
|
2023-01-11 17:32:16 +01:00
|
|
|
belongs_to :cart_item_machine_reservation, foreign_type: 'CartItem::MachineReservation', foreign_key: 'cart_item_id',
|
|
|
|
inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::MachineReservation'
|
|
|
|
belongs_to :cart_item_space_reservation, foreign_type: 'CartItem::SpaceReservation', foreign_key: 'cart_item_id',
|
|
|
|
inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::SpaceReservation'
|
|
|
|
belongs_to :cart_item_training_reservation, foreign_type: 'CartItem::TrainingReservation', foreign_key: 'cart_item_id',
|
|
|
|
inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::TrainingReservation'
|
|
|
|
belongs_to :cart_item_event_reservation, foreign_type: 'CartItem::EventReservation', foreign_key: 'cart_item_id',
|
|
|
|
inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::EventReservation'
|
2022-12-28 17:51:27 +01:00
|
|
|
|
|
|
|
belongs_to :slot
|
|
|
|
belongs_to :slots_reservation
|
|
|
|
end
|