Trần Viết Sơn
fix: refactor, add entities
c114c72
raw
history blame
553 Bytes
import {
BaseEntity,
Column,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
Relation,
} from 'typeorm';
import { UserEntity } from './user.entity.js';
@Entity('branches')
export class BranchEntity extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
name: string;
@Column()
location: string;
@Column()
phone_number: string;
@ManyToOne(() => UserEntity, (user) => user.branches)
owner: Relation<UserEntity>;
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
create_at: Date;
}