fix: change the role refrence in database
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { BaseEntity, Column, Entity } from "typeorm";
|
||||
import { Column, Entity } from "typeorm";
|
||||
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { RoleEnum } from "../enums/role.enum";
|
||||
|
||||
@Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Column, Entity, OneToOne } from "typeorm";
|
||||
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
|
||||
|
||||
import { Role } from "./role.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
@@ -26,6 +26,7 @@ export class User extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
nationalCode: string;
|
||||
|
||||
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "SET NULL" })
|
||||
@JoinColumn()
|
||||
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "RESTRICT", nullable: false })
|
||||
role: Role;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user