summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-10-02 19:29:49 +0200
committerRory& <root@rory.gay>2025-10-04 19:09:25 +0200
commitefba3f245dc9694187ee5143410ce1fb18cd7302 (patch)
tree92a16690945869a93fdd26e843ae397309ad15dd /src/api
parentfix: getting invites for a channel (diff)
downloadserver-ts-efba3f245dc9694187ee5143410ce1fb18cd7302.tar.xz
Fix ignored request schemas
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/reporting/menu/message.ts40
-rw-r--r--src/api/util/handlers/route.ts8
2 files changed, 47 insertions, 1 deletions
diff --git a/src/api/routes/reporting/menu/message.ts b/src/api/routes/reporting/menu/message.ts
new file mode 100644

index 00000000..fcf02ff8 --- /dev/null +++ b/src/api/routes/reporting/menu/message.ts
@@ -0,0 +1,40 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +import { route } from "@spacebar/api"; +import { Request, Response, Router } from "express"; +import { CollectiblesCategoriesResponse } from "@spacebar/util"; + +const router = Router({ mergeParams: true }); + +router.get( + "/", + route({ + responses: { + 200: { + body: "ReportingMenuResponse", + }, + 204: {}, + }, + }), + (req: Request, res: Response) => { + res.send([] as ReportingMenuResponseSchema); + }, +); + +export default router; diff --git a/src/api/util/handlers/route.ts b/src/api/util/handlers/route.ts
index 30ffa2d0..8425b8c2 100644 --- a/src/api/util/handlers/route.ts +++ b/src/api/util/handlers/route.ts
@@ -32,6 +32,11 @@ import { import { AnyValidateFunction } from "ajv/dist/core"; import { NextFunction, Request, Response } from "express"; +const ignoredRequestSchemas = [ + // skip validation for settings proto JSON updates - TODO: figure out if this even possible to fix? + "SettingsProtoUpdateJsonSchema" +] + declare global { // TODO: fix this // eslint-disable-next-line @typescript-eslint/no-namespace @@ -119,7 +124,8 @@ export function route(opts: RouteOptions) { } } - if (validate) { + + if (validate && !ignoredRequestSchemas.includes(opts.requestBody!)) { const valid = validate(req.body); if (!valid) { const fields: Record<