251128:1700 Backend to T3.1.1

This commit is contained in:
admin
2025-11-28 17:12:05 +07:00
parent b22d00877e
commit f7a43600a3
50 changed files with 4891 additions and 2849 deletions
@@ -1,3 +1,4 @@
// File: src/modules/rfa/entities/rfa-revision.entity.ts
import {
Entity,
PrimaryGeneratedColumn,
@@ -8,6 +9,7 @@ import {
JoinColumn,
OneToMany,
Unique,
Index,
} from 'typeorm';
import { Rfa } from './rfa.entity';
import { Correspondence } from '../../correspondence/entities/correspondence.entity';
@@ -15,7 +17,7 @@ import { RfaStatusCode } from './rfa-status-code.entity';
import { RfaApproveCode } from './rfa-approve-code.entity';
import { User } from '../../user/entities/user.entity';
import { RfaItem } from './rfa-item.entity';
import { RfaWorkflow } from './rfa-workflow.entity'; // Import เพิ่ม
import { RfaWorkflow } from './rfa-workflow.entity';
@Entity('rfa_revisions')
@Unique(['rfaId', 'revisionNumber'])
@@ -63,6 +65,20 @@ export class RfaRevision {
@Column({ type: 'text', nullable: true })
description?: string;
// ✅ [New] เพิ่ม field details สำหรับเก็บข้อมูล Dynamic ของ RFA (เช่น Method Statement Details)
@Column({ type: 'json', nullable: true })
details?: any;
// ✅ [New] Virtual Column: ดึงจำนวนแบบที่แนบ (drawingCount) จาก JSON
@Column({
name: 'v_ref_drawing_count',
type: 'int',
generatedType: 'VIRTUAL',
asExpression: "JSON_UNQUOTE(JSON_EXTRACT(details, '$.drawingCount'))",
nullable: true,
})
vRefDrawingCount?: number;
@CreateDateColumn({ name: 'created_at' })
createdAt!: Date;