module Ecom module Core class MaintenanceServiceOrder < ApplicationRecord NEW = 'New'.freeze IN_PROGRESS = 'In Progress'.freeze COMPLETED = 'Completed'.freeze STATUSES = [NEW, IN_PROGRESS, COMPLETED].freeze belongs_to :equipment_item belongs_to :maintenance_type belongs_to :prepared_by, class_name: 'Ecom::Core::User' belongs_to :approved_by, class_name: 'Ecom::Core::User', optional: true validates :title, :status, presence: true validates :status, inclusion: STATUSES end end end