chore: format
This commit is contained in:
parent
10c73ae226
commit
6baf79d76d
1 changed files with 10 additions and 26 deletions
|
|
@ -38,11 +38,7 @@ export class MenuController extends Controller {
|
||||||
const parent = await prisma.menu.findFirst({ where: { id: body.parentId } });
|
const parent = await prisma.menu.findFirst({ where: { id: body.parentId } });
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
throw new HttpError(
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Parent menu not found.", "parentMenuBadReq");
|
||||||
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 } });
|
const menu = await prisma.menu.findFirst({ where: { id: menuId } });
|
||||||
|
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
throw new HttpError(
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq");
|
||||||
HttpStatus.BAD_REQUEST,
|
|
||||||
"Menu not found.",
|
|
||||||
"menuBadReq",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await prisma.roleMenuPermission.create({
|
const record = await prisma.roleMenuPermission.create({
|
||||||
|
|
@ -140,7 +132,11 @@ export class RoleMenuController extends Controller {
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
if (e instanceof PrismaClientKnownRequestError && e.code === "P2025") {
|
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);
|
throw new Error(e);
|
||||||
});
|
});
|
||||||
|
|
@ -190,11 +186,7 @@ export class MenuComponentController extends Controller {
|
||||||
const menu = await prisma.menu.findFirst({ where: { id: body.menuId } });
|
const menu = await prisma.menu.findFirst({ where: { id: body.menuId } });
|
||||||
|
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
throw new HttpError(
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq");
|
||||||
HttpStatus.BAD_REQUEST,
|
|
||||||
"Menu not found.",
|
|
||||||
"menuBadReq",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await prisma.menuComponent.create({
|
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 } });
|
const menu = await prisma.menu.findFirst({ where: { id: body.menuId } });
|
||||||
|
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
throw new HttpError(
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq");
|
||||||
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 } });
|
const menu = await prisma.menuComponent.findFirst({ where: { id: menuComponentId } });
|
||||||
|
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
throw new HttpError(
|
throw new HttpError(HttpStatus.BAD_REQUEST, "Menu not found.", "menuBadReq");
|
||||||
HttpStatus.BAD_REQUEST,
|
|
||||||
"Menu not found.",
|
|
||||||
"menuBadReq",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await prisma.roleMenuComponentPermission.create({
|
const record = await prisma.roleMenuComponentPermission.create({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue