mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 03:05:42 +00:00
92 lines
2.3 KiB
TypeScript
92 lines
2.3 KiB
TypeScript
import { Entity, Column } from 'typeorm';
|
|
import { BaseEntity } from '@edr/api-common';
|
|
|
|
export enum VehicleType {
|
|
TRUCK = 'TRUCK',
|
|
VAN = 'VAN',
|
|
CAR = 'CAR',
|
|
BUS = 'BUS',
|
|
TRAILER = 'TRAILER',
|
|
TANKER = 'TANKER',
|
|
FLATBED = 'FLATBED',
|
|
}
|
|
|
|
export enum FuelType {
|
|
PETROL = 'PETROL',
|
|
DIESEL = 'DIESEL',
|
|
ELECTRIC = 'ELECTRIC',
|
|
HYBRID = 'HYBRID',
|
|
}
|
|
|
|
export enum VehicleStatus {
|
|
ACTIVE = 'ACTIVE',
|
|
MAINTENANCE = 'MAINTENANCE',
|
|
RETIRED = 'RETIRED',
|
|
OUT_OF_SERVICE = 'OUT_OF_SERVICE',
|
|
}
|
|
|
|
export enum VehicleAvailability {
|
|
FREE = 'FREE',
|
|
BUSY = 'BUSY',
|
|
}
|
|
|
|
@Entity({ name: 'vehicles', schema: 'freight' })
|
|
export class Vehicle extends BaseEntity {
|
|
@Column({ nullable: true })
|
|
code?: string;
|
|
|
|
@Column({ name: 'plate_number', unique: true, nullable: true })
|
|
plateNumber?: string;
|
|
|
|
@Column({ name: 'power_plate_no', nullable: true })
|
|
powerPlateNo?: string;
|
|
|
|
@Column({ name: 'trailer_plate_no', nullable: true })
|
|
trailerPlateNo?: string;
|
|
|
|
@Column({ name: 'registration_number', unique: true, nullable: true })
|
|
registrationNumber?: string;
|
|
|
|
@Column({ name: 'vehicle_type', type: 'varchar', nullable: true })
|
|
vehicleType?: VehicleType;
|
|
|
|
@Column({ nullable: true })
|
|
manufacturer?: string;
|
|
|
|
@Column({ nullable: true })
|
|
model?: string;
|
|
|
|
@Column({ nullable: true })
|
|
year?: number;
|
|
|
|
@Column({ name: 'fuel_type', type: 'varchar', nullable: true })
|
|
fuelType?: FuelType;
|
|
|
|
@Column({ nullable: true })
|
|
capacity?: number;
|
|
|
|
@Column({ name: 'status', type: 'varchar', default: VehicleStatus.ACTIVE, nullable: true })
|
|
status?: VehicleStatus;
|
|
|
|
@Column({ name: 'availability', type: 'varchar', default: VehicleAvailability.FREE, nullable: true })
|
|
availability?: VehicleAvailability;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
description?: string | null;
|
|
|
|
@Column({ name: 'assigned_driver_id', type: 'uuid', nullable: true })
|
|
assignedDriverId?: string;
|
|
|
|
@Column({ name: 'assigned_driver_name', nullable: true })
|
|
assignedDriverName?: string;
|
|
|
|
@Column({ name: 'estimated_distance_km', type: 'numeric', nullable: true })
|
|
estimatedDistanceKm?: number;
|
|
|
|
@Column({ name: 'actual_distance_km', type: 'numeric', nullable: true })
|
|
actualDistanceKm?: number;
|
|
|
|
@Column({ name: 'location_id', type: 'uuid', nullable: true })
|
|
locationId?: string;
|
|
}
|