generated from nhcarrigan/template
feat: define type, prep for company announcements
This commit is contained in:
@@ -12,6 +12,7 @@ import { announceOnReddit } from "../modules/announceOnReddit.js";
|
||||
import { announceOnTwitter } from "../modules/announceOnTwitter.js";
|
||||
import { getIpFromRequest } from "../modules/getIpFromRequest.js";
|
||||
import { summarisePost } from "../modules/summarisePost.js";
|
||||
import { isAnnouncementType } from "../utils/typeguards.js";
|
||||
import type { FastifyPluginAsync } from "fastify";
|
||||
|
||||
const oneDay = 24 * 60 * 60 * 1000;
|
||||
@@ -73,10 +74,10 @@ export const announcementRoutes: FastifyPluginAsync = async(server) => {
|
||||
});
|
||||
}
|
||||
|
||||
if (type !== "products" && type !== "community") {
|
||||
if (!isAnnouncementType(type)) {
|
||||
return await reply.status(400).send({
|
||||
error:
|
||||
"Invalid announcement type. Available types: products, community.",
|
||||
`Invalid announcement type. Available types: products, community, company.`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user