@fleetbase/fleetops-engine
Version:
Fleet & Transport Management Extension for Fleetbase
62 lines (50 loc) • 1.88 kB
JavaScript
import Model, { attr, belongsTo } from '@ember-data/model';
/**
* Local maintenance-schedule model used by the fleetops engine.
* The canonical model with full computed properties lives in fleetops-data.
* This local copy adds the polymorphic @belongsTo relationships so the
* engine's form and details components can use relationship accessors
* directly instead of raw _type / _uuid attrs.
*/
export default class MaintenanceScheduleModel extends Model {
// Identification
public_id;
name;
type;
status;
// Polymorphic subject (the asset this schedule applies to)
subject;
// Polymorphic default_assignee (who should be assigned to generated work orders)
default_assignee;
// Interval definition
interval_method;
interval_type;
interval_value;
interval_unit;
interval_distance;
interval_engine_hours;
// Baseline readings
last_service_odometer;
last_service_engine_hours;
last_service_date;
// Next-due thresholds
next_due_date;
next_due_odometer;
next_due_engine_hours;
// Work order defaults
default_priority;
instructions;
meta;
created_at;
updated_at;
// Computed display helpers
get nextDueDate() {
return this.next_due_date;
}
get isActive() {
return this.status === 'active';
}
get isPaused() {
return this.status === 'paused';
}
}