1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-26 20:54:21 +01:00
fab-manager/app/models/cart_item/reservation_slot.rb

22 lines
1.3 KiB
Ruby
Raw Normal View History

2022-12-28 17:51:27 +01:00
# frozen_string_literal: true
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
self.table_name = 'cart_item_reservation_slots'
2022-12-28 17:51:27 +01:00
belongs_to :cart_item, polymorphic: true
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