fix: no more forum posts, so remove requirements.
Node.js CI / Lint and Test (push) Successful in 1m43s

This commit is contained in:
2025-10-31 18:11:29 -07:00
parent 865b11ed21
commit 5c8faaf3f8
+3 -18
View File
@@ -44,7 +44,7 @@ export const announcementRoutes: FastifyPluginAsync = async(server) => {
// eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify requires Body instead of body.
server.post<{ Body: { title: string; content: string; type: string } }>(
"/announcement",
// eslint-disable-next-line complexity, max-statements -- This is a complex route, but it is necessary to validate the announcement.
// eslint-disable-next-line complexity -- This is a complex route, but it is necessary to validate the announcement.
async(request, reply) => {
const token = request.headers.authorization;
if (token === undefined || token !== process.env.ANNOUNCEMENT_TOKEN) {
@@ -73,25 +73,10 @@ export const announcementRoutes: FastifyPluginAsync = async(server) => {
});
}
if (title.length < 20) {
return await reply.status(400).send({
error:
// eslint-disable-next-line stylistic/max-len -- Big boi string.
"Title must be at least 20 characters long so that it may be posted on our forum.",
});
}
if (content.length < 50) {
return await reply.status(400).send({
error:
// eslint-disable-next-line stylistic/max-len -- Big boi string.
"Content must be at least 50 characters long so that it may be posted on our forum.",
});
}
if (type !== "products" && type !== "community") {
return await reply.status(400).send({
error: "Invalid announcement type.",
error:
"Invalid announcement type. Available types: products, community.",
});
}