feat(perm): update api institue permission
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s
This commit is contained in:
parent
78399701a7
commit
e1aa3b6765
1 changed files with 20 additions and 9 deletions
|
|
@ -95,6 +95,17 @@ type InstitutionUpdatePayload = {
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const MANAGE_ROLES = [
|
||||||
|
"system",
|
||||||
|
"head_of_admin",
|
||||||
|
"admin",
|
||||||
|
"executive",
|
||||||
|
"accountant",
|
||||||
|
"branch_admin",
|
||||||
|
"branch_manager",
|
||||||
|
"branch_accountant",
|
||||||
|
];
|
||||||
|
|
||||||
@Route("api/v1/institution")
|
@Route("api/v1/institution")
|
||||||
@Tags("Institution")
|
@Tags("Institution")
|
||||||
export class InstitutionController extends Controller {
|
export class InstitutionController extends Controller {
|
||||||
|
|
@ -185,7 +196,7 @@ export class InstitutionController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
@OperationId("createInstitution")
|
@OperationId("createInstitution")
|
||||||
async createInstitution(
|
async createInstitution(
|
||||||
@Body()
|
@Body()
|
||||||
|
|
@ -229,7 +240,7 @@ export class InstitutionController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put("{institutionId}")
|
@Put("{institutionId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
@OperationId("updateInstitution")
|
@OperationId("updateInstitution")
|
||||||
async updateInstitution(
|
async updateInstitution(
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
@ -278,7 +289,7 @@ export class InstitutionController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{institutionId}")
|
@Delete("{institutionId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
@OperationId("deleteInstitution")
|
@OperationId("deleteInstitution")
|
||||||
async deleteInstitution(@Path() institutionId: string) {
|
async deleteInstitution(@Path() institutionId: string) {
|
||||||
return await prisma.$transaction(async (tx) => {
|
return await prisma.$transaction(async (tx) => {
|
||||||
|
|
@ -350,7 +361,7 @@ export class InstitutionFileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put("image/{name}")
|
@Put("image/{name}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async putImage(
|
async putImage(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
@ -364,7 +375,7 @@ export class InstitutionFileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("image/{name}")
|
@Delete("image/{name}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async delImage(
|
async delImage(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
@ -394,7 +405,7 @@ export class InstitutionFileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put("attachment/{name}")
|
@Put("attachment/{name}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async putAttachment(
|
async putAttachment(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
@ -405,7 +416,7 @@ export class InstitutionFileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("attachment/{name}")
|
@Delete("attachment/{name}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async delAttachment(
|
async delAttachment(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
@ -436,7 +447,7 @@ export class InstitutionFileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put("bank-qr/{bankId}")
|
@Put("bank-qr/{bankId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async putBankImage(
|
async putBankImage(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
@ -450,7 +461,7 @@ export class InstitutionFileController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("bank-qr/{bankId}")
|
@Delete("bank-qr/{bankId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async delBankImage(
|
async delBankImage(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() institutionId: string,
|
@Path() institutionId: string,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue