feat(api): Implement filters API v2 (with some routes missing)

This commit is contained in:
Jesse Wierzbinski 2024-04-17 13:47:03 -10:00
parent ce082f8e6a
commit a37e8e92c5
No known key found for this signature in database
21 changed files with 3087 additions and 154 deletions

View file

@ -86,14 +86,12 @@ export const processRoute = async (
return errorResponse("Method not allowed", 405);
}
let auth: AuthData | null = null;
const auth: AuthData = await getFromRequest(request);
if (
route.meta.auth.required ||
route.meta.auth.requiredOnMethods?.includes(request.method as HttpVerb)
) {
auth = await getFromRequest(request);
if (!auth.user) {
return errorResponse(
"Unauthorized: access to this method requires an authenticated user",
@ -112,7 +110,7 @@ export const processRoute = async (
}
}
const parsedRequest = await new RequestParser(request)
const parsedRequest = await new RequestParser(request.clone())
.toObject()
.catch(async (err) => {
await logger.logError(