Spaces:
Sleeping
Sleeping
File size: 1,178 Bytes
c114c72 9ec4f32 c114c72 9ec4f32 c114c72 9ec4f32 17cd84b 3cdf53d 17cd84b 3cdf53d 17cd84b 3cdf53d 17cd84b 3cdf53d c114c72 3cdf53d 17cd84b 3cdf53d 17cd84b 3cdf53d c114c72 17cd84b c114c72 9ec4f32 17cd84b 9ec4f32 3cdf53d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
import {
Entity,
Column,
BaseEntity,
PrimaryGeneratedColumn,
OneToMany,
ManyToOne,
Relation,
JoinColumn,
} from 'typeorm';
import { BranchEntity } from './branch.entity.js';
import { RoleEntity } from './role.entity.js';
import { IsOptional } from 'class-validator';
@Entity('users')
export class UserEntity extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@IsOptional()
@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;
@IsOptional()
@Column({ nullable: true })
role_id: number;
@Column({ nullable: true })
hash_password: string;
@IsOptional()
@Column({ default: true })
is_valid: boolean;
@IsOptional()
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
create_at: Date;
@IsOptional()
@OneToMany(() => BranchEntity, (branch) => branch.owner)
branches: Relation<BranchEntity>[];
@IsOptional()
@ManyToOne(() => RoleEntity)
@JoinColumn({ name: 'role_id'})
role: RoleEntity;
}
|