feat: driver documents (sovereignty storage adapter) + load-test script
- documents: upload (multipart) + review (admin/CS) + auto-approve driver when all docs approved - StorageService: per-tenant local volume now, in-country storage swap via STORAGE_BASE_URL - doc.number encrypted (AES-256-GCM); migration InitDocuments; tripz-storage volume - scripts/loadtest.mjs: concurrent full trip-cycle benchmark (throughput + latency percentiles) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { EncryptedTransformer } from '../../../common/crypto/crypto.util';
|
||||
|
||||
export type DocType =
|
||||
| 'license'
|
||||
| 'national_id'
|
||||
| 'vehicle_registration'
|
||||
| 'insurance'
|
||||
| 'selfie'
|
||||
| 'vehicle_photo';
|
||||
export type DocStatus = 'pending' | 'approved' | 'rejected';
|
||||
|
||||
/** وثيقة سائق (صورة + بيانات). الجدول: tripz_driver_documents. */
|
||||
@Entity('driver_documents')
|
||||
@Index(['tenant_id', 'driver_id'])
|
||||
@Index(['tenant_id', 'status'])
|
||||
export class DriverDocument {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ type: 'uuid' })
|
||||
tenant_id: string;
|
||||
|
||||
@Column({ type: 'uuid' })
|
||||
driver_id: string;
|
||||
|
||||
@Column()
|
||||
type: DocType;
|
||||
|
||||
@Column()
|
||||
file_key: string; // مفتاح التخزين (سيرفر التوطين لاحقاً)
|
||||
|
||||
// رقم الرخصة/الهوية — مشفّر at-rest (AES-256-GCM)
|
||||
@Column({ type: 'varchar', nullable: true, transformer: EncryptedTransformer })
|
||||
number: string | null;
|
||||
|
||||
@Column({ type: 'date', nullable: true })
|
||||
expiry_date: string | null;
|
||||
|
||||
@Column({ type: 'varchar', default: 'pending' })
|
||||
status: DocStatus;
|
||||
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
review_note: string | null;
|
||||
|
||||
@Column({ type: 'uuid', nullable: true })
|
||||
reviewed_by: string | null;
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updated_at: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user