fix: bug in thre login process
This commit is contained in:
@@ -3,29 +3,41 @@ import { Column, Entity, JoinColumn, OneToOne, Unique } from "typeorm";
|
||||
import { User } from "./user.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { Address } from "../../address/entities/address.entity";
|
||||
import { GenderType } from "../enums/gender-type.enum";
|
||||
import { GenderEnum } from "../enums/gender-type.enum";
|
||||
import { NationalityEnum } from "../enums/nationality.enum";
|
||||
|
||||
@Unique(["user"])
|
||||
@Entity()
|
||||
export class RealUser extends BaseEntity {
|
||||
@Column({
|
||||
type: "enum",
|
||||
enum: GenderType,
|
||||
nullable: true,
|
||||
})
|
||||
gender: GenderType;
|
||||
@Column({ type: "varchar", length: 150 })
|
||||
firstName: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@Column({ type: "varchar", length: 200 })
|
||||
lastName: string;
|
||||
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
fatherName: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
nationality: string;
|
||||
@Column({ type: "varchar", length: 12, nullable: true })
|
||||
birthDate: string;
|
||||
|
||||
@Column({ type: "varchar", length: 100, unique: true })
|
||||
nationalCode: string;
|
||||
|
||||
@Column({ type: "varchar", length: 11, unique: true, nullable: false })
|
||||
phone: string;
|
||||
|
||||
@Column({ type: "enum", enum: GenderEnum })
|
||||
gender: GenderEnum;
|
||||
|
||||
@Column({ type: "enum", enum: NationalityEnum })
|
||||
nationality: NationalityEnum;
|
||||
|
||||
@OneToOne(() => Address, { nullable: false, cascade: true })
|
||||
@JoinColumn()
|
||||
address: Address;
|
||||
|
||||
@OneToOne(() => User, (user) => user.realUser, { onDelete: "CASCADE" })
|
||||
@OneToOne(() => User, (user) => user.realUser, { onDelete: "CASCADE", nullable: false })
|
||||
@JoinColumn()
|
||||
user: User;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user