mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
75 lines
1.8 KiB
TypeScript
75 lines
1.8 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',
|
|
}
|
|
|
|
@Entity({ name: 'vehicles', schema: 'freight' })
|
|
export class Vehicle extends BaseEntity {
|
|
@Column({ name: 'plate_number', unique: true, nullable: true })
|
|
plateNumber?: 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({ 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: 'code', nullable: true })
|
|
code?: string;
|
|
|
|
@Column({ name: 'power_plate_no', nullable: true })
|
|
powerPlateNo?: string;
|
|
|
|
@Column({ name: 'trailer_plate_no', nullable: true })
|
|
trailerPlateNo?: string;
|
|
}
|