add isBlank

This commit is contained in:
kittapath 2024-10-03 15:37:28 +07:00
parent e805759af5
commit 85657d1c32
3 changed files with 39 additions and 18 deletions

View file

@ -48,9 +48,9 @@ export class PermissionOrgController extends Controller {
*/
@Get()
async GetActiveRootIdAdmin(@Request() request: RequestWithUser) {
if (!request.user.role.includes("SUPER_ADMIN")) {
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
}
// if (!request.user.role.includes("SUPER_ADMIN")) {
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
// }
const orgRevisionActive = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsCurrent: false, orgRevisionIsDraft: true },
});
@ -76,9 +76,9 @@ export class PermissionOrgController extends Controller {
searchField?: "fullName" | "position" | "posNo" | "postype" | "poslevel",
@Query() searchKeyword: string = "",
) {
if (!request.user.role.includes("SUPER_ADMIN")) {
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
}
// if (!request.user.role.includes("SUPER_ADMIN")) {
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
// }
let queryLike =
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
if (searchField == "postype") {
@ -233,9 +233,9 @@ export class PermissionOrgController extends Controller {
searchKeyword: string;
},
) {
if (!request.user.role.includes("SUPER_ADMIN")) {
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
}
// if (!request.user.role.includes("SUPER_ADMIN")) {
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
// }
let profiles: any = [];
if (requestBody.id != null) {
const _permissionOrg = await this.orgRootRepository.findOne({
@ -423,9 +423,9 @@ export class PermissionOrgController extends Controller {
@Request() request: RequestWithUser,
@Body() requestBody: { nodeId: string; personId: string },
) {
if (!request.user.role.includes("SUPER_ADMIN")) {
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
}
// if (!request.user.role.includes("SUPER_ADMIN")) {
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
// }
const orgRoot = await this.orgRootRepository.findOne({
where: { id: requestBody.nodeId },
});
@ -472,9 +472,9 @@ export class PermissionOrgController extends Controller {
*/
@Delete("{id}")
async Delete(@Request() request: RequestWithUser, @Path() id: string) {
if (!request.user.role.includes("SUPER_ADMIN")) {
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
}
// if (!request.user.role.includes("SUPER_ADMIN")) {
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
// }
// const orgRoot = await this.orgRootRepository.findOne({
// where: { id: nodeId },
// relations: ["permissionOrgRoots"],