add save default view

This commit is contained in:
miloschwartz
2026-07-02 22:27:51 -04:00
parent 12f9ac94fd
commit f0546eb622
18 changed files with 665 additions and 75 deletions
@@ -6,6 +6,7 @@ import { and, eq } from "drizzle-orm";
import { NextFunction, Request, Response } from "express";
import createHttpError from "http-errors";
import { ActionsEnum, checkUserActionPermission } from "@server/auth/actions";
import { isLauncherDefaultOverrideViewName } from "./launcherDefaultView";
export async function deleteLauncherView(
req: Request,
@@ -46,6 +47,15 @@ export async function deleteLauncherView(
);
}
if (isLauncherDefaultOverrideViewName(existing.name)) {
return next(
createHttpError(
HttpCode.BAD_REQUEST,
"The default view cannot be deleted from here"
)
);
}
const isPersonalView = existing.userId === userId;
const isOrgWideView = existing.userId == null;
const canManageOrgWide = await checkUserActionPermission(