- Add 11 entities: ServiceChecklist, ChecklistItemTemplate, ChecklistResponse, ChecklistItemResponse, WorkLog, DiagnosisRecord, ActivityCatalog, RootCauseCatalog, FieldEvidence, FieldCheckin, OfflineQueueItem - Add 5 services: ChecklistService, WorkLogService, DiagnosisService, OfflineSyncService, CheckinService - Add 5 controllers: ChecklistController, WorkLogController, DiagnosisController, SyncController, CheckinController - Integrate module in main.ts with routes under /api/v1/field/* Features: - Configurable checklists with multiple item types - Labor time tracking with pause/resume - Diagnosis with OBD-II code parsing - Offline sync queue with conflict resolution - Technician check-in/check-out with geolocation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
/**
|
|
* RootCauseCatalog Entity
|
|
* Mecanicas Diesel - ERP Suite
|
|
*
|
|
* Catalog of root causes for diagnostics.
|
|
* Module: MMD-012 Field Service
|
|
*/
|
|
|
|
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
Index,
|
|
} from 'typeorm';
|
|
|
|
@Entity({ name: 'root_cause_catalog', schema: 'field_service' })
|
|
@Index('idx_root_cause_tenant', ['tenantId'])
|
|
@Index('idx_root_cause_category', ['tenantId', 'category'])
|
|
export class RootCauseCatalog {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'tenant_id', type: 'uuid' })
|
|
tenantId: string;
|
|
|
|
@Column({ type: 'varchar', length: 50 })
|
|
code: string;
|
|
|
|
@Column({ type: 'varchar', length: 200 })
|
|
name: string;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
description?: string;
|
|
|
|
@Column({ type: 'varchar', length: 100 })
|
|
category: string;
|
|
|
|
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
subcategory?: string;
|
|
|
|
@Column({ name: 'vehicle_types', type: 'jsonb', nullable: true })
|
|
vehicleTypes?: string[];
|
|
|
|
@Column({ name: 'standard_recommendation', type: 'text', nullable: true })
|
|
standardRecommendation?: string;
|
|
|
|
@Column({ name: 'estimated_repair_hours', type: 'decimal', precision: 5, scale: 2, nullable: true })
|
|
estimatedRepairHours?: number;
|
|
|
|
@Column({ name: 'is_active', type: 'boolean', default: true })
|
|
isActive: boolean;
|
|
|
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
}
|