251225:1703 On going update to 1.7.0: Refoctory drawing Module not finish
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-25 17:03:33 +07:00
parent 7db6a003db
commit cd73cc1549
60 changed files with 8201 additions and 832 deletions

View File

@@ -7,12 +7,15 @@ import {
JoinColumn,
ManyToMany,
JoinTable,
Unique,
} from 'typeorm';
import { ShopDrawing } from './shop-drawing.entity';
import { ContractDrawing } from './contract-drawing.entity';
import { Attachment } from '../../../common/file-storage/entities/attachment.entity';
import { User } from '../../user/entities/user.entity';
@Entity('shop_drawing_revisions')
@Unique(['shopDrawingId', 'isCurrent'])
export class ShopDrawingRevision {
@PrimaryGeneratedColumn()
id!: number; // เติม !
@@ -41,6 +44,20 @@ export class ShopDrawingRevision {
@CreateDateColumn({ name: 'created_at' })
createdAt!: Date; // เติม !
@Column({
name: 'is_current',
type: 'boolean',
nullable: true,
default: null,
})
isCurrent?: boolean | null;
@Column({ name: 'created_by', nullable: true })
createdBy?: number;
@Column({ name: 'updated_by', nullable: true })
updatedBy?: number;
// Relations
@ManyToOne(() => ShopDrawing, (shopDrawing) => shopDrawing.revisions, {
onDelete: 'CASCADE',
@@ -48,6 +65,14 @@ export class ShopDrawingRevision {
@JoinColumn({ name: 'shop_drawing_id' })
shopDrawing!: ShopDrawing; // เติม !
@ManyToOne(() => User)
@JoinColumn({ name: 'created_by' })
creator?: User;
@ManyToOne(() => User)
@JoinColumn({ name: 'updated_by' })
updater?: User;
// References to Contract Drawings (M:N)
@ManyToMany(() => ContractDrawing)
@JoinTable({