Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -1,7 +1,7 @@
import { db } from "../../db.server";
import { Permission, Role, RolePermission } from "@hivegrid/db/prisma-browser";
import { getRoleByName } from "./roles.db.server";
import { createRolePermission, getAllRolePermissions } from "./rolePermissions.db.server";
import { createRolePermission, getAllRolePermissions, invalidateRoleAssignmentScopes } from "./rolePermissions.db.server";
import RowFiltersHelper from "~/utils/helpers/RowFiltersHelper";
import { FiltersDto } from "~/application/dtos/data/FiltersDto";
import { cachified, clearCacheKey } from "~/utils/cache.server";
@@ -131,10 +131,7 @@ export async function getNextPermissionsOrder(type?: string): Promise<number> {
);
}
export async function createPermissions(
permissions: { inRoles: string[]; name: string; description: string; type: string }[],
fromOrder: number = 0
) {
export async function createPermissions(permissions: { inRoles: string[]; name: string; description: string; type: string }[], fromOrder: number = 0) {
const allRolePermissions = await getAllRolePermissions();
const allPermissions = await getAllPermissions();
const permissionByName = new Map<string, { id: string; name: string }>(allPermissions.map((permission) => [permission.name, permission]));
@@ -196,24 +193,17 @@ export async function updatePermission(
order?: number;
}
) {
return await db.permission
.update({
where: { id },
data,
})
.then((item) => {
clearCacheKey(`permission:${item.name}`);
return item;
});
const links = await db.rolePermission.findMany({ where: { permissionId: id }, select: { roleId: true } });
const item = await db.permission.update({ where: { id }, data });
clearCacheKey(`permission:${item.name}`);
await invalidateRoleAssignmentScopes(links.map((link) => link.roleId));
return item;
}
export async function deletePermission(id: string) {
return await db.permission
.delete({
where: { id },
})
.then((item) => {
clearCacheKey(`permission:${item.name}`);
return item;
});
const links = await db.rolePermission.findMany({ where: { permissionId: id }, select: { roleId: true } });
const item = await db.permission.delete({ where: { id } });
clearCacheKey(`permission:${item.name}`);
await invalidateRoleAssignmentScopes(links.map((link) => link.roleId));
return item;
}