This commit is contained in:
parent
d6383ec2c4
commit
ca7d2f2a75
2 changed files with 29 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ import {
|
|||
Patch,
|
||||
Path,
|
||||
Post,
|
||||
Query,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
|
|
@ -36,8 +37,21 @@ export class AuthRoleController extends Controller {
|
|||
private redis = require("redis");
|
||||
|
||||
@Get("list")
|
||||
public async listAuthRole() {
|
||||
const getList = await this.authRoleRepo.find();
|
||||
public async listAuthRole(
|
||||
@Request() req: RequestWithUser,
|
||||
@Query("isAdminVisibled ") isAdminVisibled : string = "false",
|
||||
) {
|
||||
let condition: any = {};
|
||||
if(isAdminVisibled.toLowerCase() === "true"){
|
||||
condition = { isAdminVisibled: true };
|
||||
}else{
|
||||
condition = {};
|
||||
}
|
||||
const getList = await this.authRoleRepo.find(
|
||||
{
|
||||
where: condition,
|
||||
}
|
||||
);
|
||||
// if (!getList || getList.length === 0) {
|
||||
// throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
// }
|
||||
|
|
@ -161,6 +175,7 @@ export class AuthRoleController extends Controller {
|
|||
body: {
|
||||
roleName: string;
|
||||
roleDescription: string;
|
||||
isAdminVisibled?: boolean;
|
||||
authRoleAttrs: Array<{
|
||||
// id: string;
|
||||
authSysId: string;
|
||||
|
|
@ -187,6 +202,7 @@ export class AuthRoleController extends Controller {
|
|||
}));
|
||||
|
||||
Object.assign(record, {
|
||||
isAdminVisibled: body.isAdminVisibled?body.isAdminVisibled:false,
|
||||
roleName: body.roleName,
|
||||
roleDescription: body.roleDescription,
|
||||
lastUpdateFullName: req.user.name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue