251225:1703 On going update to 1.7.0: Refoctory drawing Module not finish
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user