Trần Viết Sơn
fix: refactor, add entities
c114c72
raw
history blame
874 Bytes
import {
Entity,
Column,
BaseEntity,
PrimaryGeneratedColumn,
OneToMany,
Relation,
} from 'typeorm';
import { BranchEntity } from './branch.entity.js';
@Entity('users')
export class UserEntity extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ nullable: true })
avatar: string;
@Column({ nullable: true })
full_name: string;
@Column({ nullable: true })
phone_number: string;
@Column({ nullable: true })
address: string;
@Column({ nullable: true })
email: string;
@Column({ nullable: true })
role_id: number;
@Column({ nullable: true })
hash_password: string;
@Column({ default: true })
is_valid: boolean;
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
create_at: Date;
@OneToMany(() => BranchEntity, (branch) => branch.owner)
branches: Relation<BranchEntity>[];
}