refactor: change the role to roles and many to many
This commit is contained in:
@@ -126,11 +126,10 @@ export class InvoicesService {
|
||||
}
|
||||
|
||||
//*********************************** */
|
||||
|
||||
async getInvoiceById(invoiceId: string, role: RoleEnum, userId: string) {
|
||||
async getInvoiceById(invoiceId: string, roles: RoleEnum[], userId: string) {
|
||||
let invoice: Invoice | null;
|
||||
|
||||
if (role === RoleEnum.ADMIN) {
|
||||
if (roles.includes(RoleEnum.ADMIN)) {
|
||||
invoice = await this.invoiceRepository.findOne({
|
||||
where: { id: invoiceId },
|
||||
relations: { items: { subscriptionPlan: true }, user: true },
|
||||
|
||||
Reference in New Issue
Block a user