refactor: change the role to roles and many to many
This commit is contained in:
@@ -11,20 +11,41 @@ export class UserRepository extends Repository<User> {
|
||||
}
|
||||
|
||||
async findOneWithEmail(email: string): Promise<User | null> {
|
||||
return this.findOneBy({
|
||||
email,
|
||||
return this.findOne({
|
||||
where: {
|
||||
email,
|
||||
},
|
||||
relations: {
|
||||
roles: {
|
||||
permissions: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async findOneWithPhone(phone: string): Promise<User | null> {
|
||||
return this.findOneBy({
|
||||
phone,
|
||||
return this.findOne({
|
||||
where: {
|
||||
phone,
|
||||
},
|
||||
relations: {
|
||||
roles: {
|
||||
permissions: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async findOneWithUserName(userName: string): Promise<User | null> {
|
||||
return this.findOneBy({
|
||||
userName,
|
||||
return this.findOne({
|
||||
where: {
|
||||
userName,
|
||||
},
|
||||
relations: {
|
||||
roles: {
|
||||
permissions: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user