From c5600add96939c274cc17167d64b387c5c1376fc Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Wed, 4 Sep 2024 14:01:59 +0700 Subject: [PATCH] fix: change role name --- src/controllers/product/group-controller.ts | 6 +++--- src/controllers/product/product-controller.ts | 6 +++--- src/controllers/quotation-controller.ts | 6 +++--- src/controllers/service/service-controller.ts | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/controllers/product/group-controller.ts b/src/controllers/product/group-controller.ts index 991dacb..50ae4e0 100644 --- a/src/controllers/product/group-controller.ts +++ b/src/controllers/product/group-controller.ts @@ -111,7 +111,7 @@ export class ProductGroup extends Controller { } @Post() - @Security("keycloak", ["system", "head_of_admin", "admin", "branch_accountant", "accountant"]) + @Security("keycloak", ["system", "head_of_admin", "admin", "account", "head_of_account"]) async createProductGroup(@Request() req: RequestWithUser, @Body() body: ProductGroupCreate) { const record = await prisma.$transaction( async (tx) => { @@ -149,7 +149,7 @@ export class ProductGroup extends Controller { } @Put("{groupId}") - @Security("keycloak", ["system", "head_of_admin", "admin", "branch_accountant", "accountant"]) + @Security("keycloak", ["system", "head_of_admin", "admin", "account", "head_of_account"]) async editProductGroup( @Request() req: RequestWithUser, @Body() body: ProductGroupUpdate, @@ -176,7 +176,7 @@ export class ProductGroup extends Controller { } @Delete("{groupId}") - @Security("keycloak", ["system", "head_of_admin", "admin", "branch_accountant", "accountant"]) + @Security("keycloak", ["system", "head_of_admin", "admin", "account", "head_of_account"]) async deleteProductGroup(@Path() groupId: string) { const record = await prisma.productGroup.findFirst({ where: { id: groupId } }); diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index 3011810..a1de62a 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -31,8 +31,8 @@ const MANAGE_ROLES = [ "admin", "branch_admin", "branch_manager", - "accountant", - "branch_accountant", + "head_of_account", + "account", ]; type ProductCreate = { @@ -87,7 +87,7 @@ function imageLocation(id: string) { } function globalAllow(roles?: string[]) { - return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "accountant"].some( + return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "head_of_account"].some( (v) => roles?.includes(v), ); } diff --git a/src/controllers/quotation-controller.ts b/src/controllers/quotation-controller.ts index 91657dc..12a4cdc 100644 --- a/src/controllers/quotation-controller.ts +++ b/src/controllers/quotation-controller.ts @@ -163,12 +163,12 @@ const MANAGE_ROLES = [ "admin", "branch_admin", "branch_manager", - "accountant", - "branch_accountant", + "head_of_account", + "account", ]; function globalAllow(roles?: string[]) { - return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "accountant"].some( + return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "head_of_account"].some( (v) => roles?.includes(v), ); } diff --git a/src/controllers/service/service-controller.ts b/src/controllers/service/service-controller.ts index b4c58d8..140ed34 100644 --- a/src/controllers/service/service-controller.ts +++ b/src/controllers/service/service-controller.ts @@ -31,8 +31,8 @@ const MANAGE_ROLES = [ "admin", "branch_admin", "branch_manager", - "accountant", - "branch_accountant", + "head_of_account", + "account", ]; type ServiceCreate = { @@ -73,7 +73,7 @@ function imageLocation(id: string) { } function globalAllow(roles?: string[]) { - return ["system", "head_of_admin", "admin", "accountant"].some((v) => roles?.includes(v)); + return ["system", "head_of_admin", "admin", "head_of_account"].some((v) => roles?.includes(v)); } @Route("api/v1/service")