mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-01 21:43:27 +00:00
driver
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { Entity, Column, Index } from 'typeorm';
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
|
||||
export enum DriverStatus {
|
||||
ACTIVE = 'ACTIVE',
|
||||
INACTIVE = 'INACTIVE',
|
||||
SUSPENDED = 'SUSPENDED',
|
||||
ON_LEAVE = 'ON_LEAVE',
|
||||
}
|
||||
|
||||
@Entity({ name: 'drivers', schema: 'freight' })
|
||||
@Index(['licenseNumber'])
|
||||
@Index(['email'])
|
||||
@Index(['phoneNumber'])
|
||||
@Index(['status'])
|
||||
export class Driver extends BaseEntity {
|
||||
@Column({ name: 'license_number', unique: true })
|
||||
licenseNumber!: string;
|
||||
|
||||
@Column({ name: 'first_name' })
|
||||
firstName!: string;
|
||||
|
||||
@Column({ name: 'last_name' })
|
||||
lastName!: string;
|
||||
|
||||
@Column({ unique: true })
|
||||
email!: string;
|
||||
|
||||
@Column({ name: 'phone_number', unique: true })
|
||||
phoneNumber!: string;
|
||||
|
||||
@Column({ name: 'date_of_birth', type: 'date' })
|
||||
dateOfBirth!: Date;
|
||||
|
||||
@Column({ name: 'license_expiry_date', type: 'date' })
|
||||
licenseExpiryDate!: Date;
|
||||
|
||||
@Column({ type: 'varchar', default: DriverStatus.ACTIVE })
|
||||
status!: DriverStatus;
|
||||
|
||||
@Column({ name: 'vehicle_types_authorized', type: 'varchar', array: true, nullable: true })
|
||||
vehicleTypesAuthorized?: string[];
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
address!: string | null;
|
||||
|
||||
@Column({ name: 'emergency_contact', nullable: true })
|
||||
emergencyContact!: string | null;
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
notes!: string | null;
|
||||
|
||||
@Column({ name: 'total_trips', type: 'int', default: 0 })
|
||||
totalTrips!: number;
|
||||
|
||||
@Column({ type: 'numeric', precision: 3, scale: 2, nullable: true })
|
||||
rating!: number | null;
|
||||
}
|
||||
Reference in New Issue
Block a user