diff --git a/src/controllers/permission-controller.ts b/src/controllers/permission-controller.ts index d10c649..67827b1 100644 --- a/src/controllers/permission-controller.ts +++ b/src/controllers/permission-controller.ts @@ -38,11 +38,7 @@ export class MenuController extends Controller { const parent = await prisma.menu.findFirst({ where: { id: body.parentId } }); if (!parent) { - throw new HttpError( - HttpStatus.BAD_REQUEST, - "Parent menu not found.", - "parentMenuBadReq", - ); + throw new HttpError(HttpStatus.BAD_REQUEST, "Parent menu not found.", "parentMenuBadReq"); } } @@ -111,11 +107,7 @@ export class RoleMenuController extends Controller { const menu = await prisma.menu.findFirst({ where: { id: menuId } }); if (!menu) { - throw new HttpError( - HttpStatus.BAD_REQUEST, - "Menu not found.", - "menuBadReq", - ); + throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq"); } const record = await prisma.roleMenuPermission.create({ @@ -140,7 +132,11 @@ export class RoleMenuController extends Controller { }) .catch((e) => { if (e instanceof PrismaClientKnownRequestError && e.code === "P2025") { - throw new HttpError(HttpStatus.NOT_FOUND, "Role menu cannot be found.", "roleMenuNotFound"); + throw new HttpError( + HttpStatus.NOT_FOUND, + "Role menu cannot be found.", + "roleMenuNotFound", + ); } throw new Error(e); }); @@ -190,11 +186,7 @@ export class MenuComponentController extends Controller { const menu = await prisma.menu.findFirst({ where: { id: body.menuId } }); if (!menu) { - throw new HttpError( - HttpStatus.BAD_REQUEST, - "Menu not found.", - "menuBadReq", - ); + throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq"); } const record = await prisma.menuComponent.create({ @@ -212,11 +204,7 @@ export class MenuComponentController extends Controller { const menu = await prisma.menu.findFirst({ where: { id: body.menuId } }); if (!menu) { - throw new HttpError( - HttpStatus.BAD_REQUEST, - "Menu not found.", - "menuBadReq", - ); + throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq"); } } @@ -284,11 +272,7 @@ export class RoleMenuComponentController extends Controller { const menu = await prisma.menuComponent.findFirst({ where: { id: menuComponentId } }); if (!menu) { - throw new HttpError( - HttpStatus.BAD_REQUEST, - "Menu not found.", - "menuBadReq", - ); + throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq"); } const record = await prisma.roleMenuComponentPermission.create({