refactor: change the role to roles and many to many
This commit is contained in:
@@ -7,7 +7,6 @@ import { DataSource, Not, QueryRunner } from "typeorm";
|
||||
|
||||
import { PaginationDto } from "../../../common/DTO/pagination.dto";
|
||||
import { CommonMessage, PaymentMessage, UserMessage, WalletMessage } from "../../../common/enums/message.enum";
|
||||
import { Role } from "../../users/entities/role.entity";
|
||||
import { User } from "../../users/entities/user.entity";
|
||||
import { RoleEnum } from "../../users/enums/role.enum";
|
||||
import { PaginationUtils } from "../../utils/providers/pagination.utils";
|
||||
@@ -263,11 +262,10 @@ export class PaymentsService {
|
||||
await this.bankAccountsRepository.save({ ...bankAccount, ...updateDto });
|
||||
}
|
||||
//*********************************** */
|
||||
async getBankAccounts(role: Role) {
|
||||
const userRole = role as unknown as RoleEnum;
|
||||
async getBankAccounts(roles: RoleEnum[]) {
|
||||
let bankAccounts: BankAccount[];
|
||||
|
||||
if (userRole === RoleEnum.USER) {
|
||||
if (roles.includes(RoleEnum.USER)) {
|
||||
bankAccounts = await this.bankAccountsRepository.find({ where: { isActive: true } });
|
||||
} else {
|
||||
bankAccounts = await this.bankAccountsRepository.find();
|
||||
|
||||
Reference in New Issue
Block a user