mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): ✨ Implement filters API v2 (with some routes missing)
This commit is contained in:
parent
ce082f8e6a
commit
a37e8e92c5
21 changed files with 3087 additions and 154 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue