partial: user routes

This commit is contained in:
DecDuck
2025-08-10 10:19:45 +10:00
parent 80f7757558
commit a0b4381f0b
54 changed files with 545 additions and 410 deletions

View File

@ -184,9 +184,6 @@ class ACLManager {
if (!token) return false;
if (token.mode != APITokenMode.System) return false;
// If empty, we just want to check we are an admin *at all*, not specific ACLs
if (acls.length == 0) return true;
for (const acl of acls) {
const tokenACLIndex = token.acls.findIndex((e) => e == acl);
if (tokenACLIndex != -1) return true;

View File

@ -17,7 +17,9 @@ type ClientUtils = {
const NONCE_LENIENCE = 30_000;
export function defineClientEventHandler<T>(handler: EventHandlerFunction<T>) {
export function defineClientEventHandler<R extends EventHandlerRequest = object, K = unknown>(
handler: (h3: H3Event<R>, utils: ClientUtils) => Promise<K> | K,
) {
return defineEventHandler(async (h3) => {
const header = getHeader(h3, "Authorization");
if (!header) throw createError({ statusCode: 403 });

View File

@ -46,9 +46,9 @@ class NewsManager {
options: {
take?: number;
skip?: number;
orderBy?: "asc" | "desc";
orderBy?: "asc" | "desc" | undefined;
tags?: string[];
search?: string;
search?: string | undefined;
} = {},
) {
return await prisma.article.findMany({