mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import { Entity, Column } from 'typeorm';
|
|
import { BaseEntity } from '@edr/api-common';
|
|
|
|
export enum DriverStatus {
|
|
ACTIVE = 'ACTIVE',
|
|
INACTIVE = 'INACTIVE',
|
|
SUSPENDED = 'SUSPENDED',
|
|
ON_LEAVE = 'ON_LEAVE',
|
|
}
|
|
|
|
export enum DriverGender {
|
|
MALE = 'MALE',
|
|
FEMALE = 'FEMALE',
|
|
OTHER = 'OTHER',
|
|
}
|
|
|
|
@Entity({ name: 'drivers', schema: 'freight' })
|
|
export class Driver extends BaseEntity {
|
|
@Column({ name: 'license_number', unique: true, nullable: true })
|
|
licenseNumber?: string;
|
|
|
|
@Column({ name: 'first_name', nullable: true })
|
|
firstName?: string;
|
|
|
|
@Column({ name: 'last_name', nullable: true })
|
|
lastName?: string;
|
|
|
|
@Column({ unique: true, nullable: true })
|
|
email?: string;
|
|
|
|
@Column({ name: 'phone_number', unique: true, nullable: true })
|
|
phoneNumber?: string;
|
|
|
|
@Column({ name: 'date_of_birth', type: 'date', nullable: true })
|
|
dateOfBirth?: Date;
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
gender?: DriverGender | null;
|
|
|
|
@Column({ name: 'license_expiry_date', type: 'date', nullable: true })
|
|
licenseExpiryDate?: Date;
|
|
|
|
@Column({ type: 'varchar', default: DriverStatus.ACTIVE, nullable: true })
|
|
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', type: 'varchar', nullable: true })
|
|
emergencyContact?: string | null;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
notes?: string | null;
|
|
|
|
@Column({ name: 'total_trips', type: 'int', default: 0, nullable: true })
|
|
totalTrips?: number;
|
|
|
|
@Column({ type: 'numeric', precision: 3, scale: 2, nullable: true })
|
|
rating?: number | null;
|
|
|
|
@Column({ name: 'fayda_verified', type: 'boolean', default: false, nullable: true })
|
|
faydaVerified?: boolean;
|
|
|
|
/** Fayda OIDC subject the identity was verified against. Unique — one driver
|
|
* record per verified Fayda identity (NULLs allowed for legacy/unverified). */
|
|
@Column({ name: 'fayda_sub', type: 'varchar', unique: true, nullable: true })
|
|
faydaSub?: string | null;
|
|
}
|