mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-14 09:41:44 +02:00
add save default view
This commit is contained in:
@@ -7,6 +7,7 @@ import moment from "moment";
|
||||
import { fromZodError } from "zod-validation-error";
|
||||
import { z } from "zod";
|
||||
import { ActionsEnum, checkUserActionPermission } from "@server/auth/actions";
|
||||
import { isLauncherDefaultOverrideViewName } from "./launcherDefaultView";
|
||||
import { launcherViewConfigSchema } from "./types";
|
||||
|
||||
const createLauncherViewBodySchema = z.strictObject({
|
||||
@@ -40,6 +41,15 @@ export async function createLauncherView(
|
||||
);
|
||||
}
|
||||
|
||||
if (isLauncherDefaultOverrideViewName(parsed.data.name)) {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
"This view name is reserved"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (parsed.data.orgWide) {
|
||||
const canCreateOrgWide = await checkUserActionPermission(
|
||||
ActionsEnum.createOrgWideLauncherView,
|
||||
|
||||
Reference in New Issue
Block a user