690327:1651 Fixing Project list by ATG Opus #01
This commit is contained in:
@@ -1,8 +1,20 @@
|
|||||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
|
// File: backend/src/modules/project/entities/project.entity.ts
|
||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
Column,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
OneToMany,
|
||||||
|
CreateDateColumn,
|
||||||
|
UpdateDateColumn,
|
||||||
|
DeleteDateColumn,
|
||||||
|
} from 'typeorm';
|
||||||
import { Exclude } from 'class-transformer';
|
import { Exclude } from 'class-transformer';
|
||||||
import { UuidBaseEntity } from '../../../common/entities/uuid-base.entity';
|
import { UuidBaseEntity } from '../../../common/entities/uuid-base.entity';
|
||||||
import { Contract } from '../../contract/entities/contract.entity';
|
import { Contract } from '../../contract/entities/contract.entity';
|
||||||
|
|
||||||
|
// Change Log:
|
||||||
|
// - 2026-03-27: เพิ่ม createdAt, updatedAt, deletedAt ที่ขาดหายไปตาม DB schema (แก้ Unknown column 'project.createdAt')
|
||||||
|
|
||||||
@Entity('projects')
|
@Entity('projects')
|
||||||
export class Project extends UuidBaseEntity {
|
export class Project extends UuidBaseEntity {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
@@ -20,6 +32,15 @@ export class Project extends UuidBaseEntity {
|
|||||||
@Column({ name: 'is_active', default: 1, type: 'tinyint' })
|
@Column({ name: 'is_active', default: 1, type: 'tinyint' })
|
||||||
isActive!: boolean;
|
isActive!: boolean;
|
||||||
|
|
||||||
|
@CreateDateColumn({ name: 'created_at' })
|
||||||
|
createdAt!: Date;
|
||||||
|
|
||||||
|
@UpdateDateColumn({ name: 'updated_at' })
|
||||||
|
updatedAt!: Date;
|
||||||
|
|
||||||
|
@DeleteDateColumn({ name: 'deleted_at', select: false })
|
||||||
|
deletedAt?: Date;
|
||||||
|
|
||||||
@OneToMany(() => Contract, (contract) => contract.project)
|
@OneToMany(() => Contract, (contract) => contract.project)
|
||||||
contracts!: Contract[];
|
contracts!: Contract[];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user