This commit is contained in:
2025-03-06 20:50:31 +01:00
commit 4a1397651f
68 changed files with 10049 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
/* Bitmap Based Roles
* Admin and editor role === 6
* User role === 1
* Editor role === 2
* Admin role === 4
* Highest role is 7
*/
export enum Role {
USER = 1, // 001
EDITOR = 2, // 010
ADMIN = 4, // 100
}
export function hasPermission(userRole: number, requiredRole: Role): boolean {
return (userRole & requiredRole) !== 0;
}
+7
View File
@@ -0,0 +1,7 @@
import { z } from "zod";
export const articleSchema = z.object({
title: z.string().min(1),
content: z.string().optional(),
authorId: z.string().optional(),
});
+5
View File
@@ -0,0 +1,5 @@
import { z } from "zod";
export const categorySchema = z.object({
name: z.string().min(1),
});