mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 14:38:12 +00:00
65 lines
1.3 KiB
TypeScript
65 lines
1.3 KiB
TypeScript
import { Entity, Column, Index } 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' })
|
|
@Index(['plateNumber'])
|
|
@Index(['registrationNumber'])
|
|
@Index(['status'])
|
|
@Index(['vehicleType'])
|
|
@Index(['manufacturer'])
|
|
export class Vehicle extends BaseEntity {
|
|
@Column({ name: 'plate_number', unique: true })
|
|
plateNumber!: string;
|
|
|
|
@Column({ name: 'registration_number', unique: true })
|
|
registrationNumber!: string;
|
|
|
|
@Column({ name: 'vehicle_type', type: 'varchar' })
|
|
vehicleType!: VehicleType;
|
|
|
|
@Column()
|
|
manufacturer!: string;
|
|
|
|
@Column()
|
|
model!: string;
|
|
|
|
@Column()
|
|
year!: number;
|
|
|
|
@Column({ name: 'fuel_type', type: 'varchar' })
|
|
fuelType!: FuelType;
|
|
|
|
@Column()
|
|
capacity!: number;
|
|
|
|
@Column({ name: 'status', type: 'varchar', default: VehicleStatus.ACTIVE })
|
|
status!: VehicleStatus;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
description!: string | null;
|
|
}
|