diff --git a/src/api/routes/guilds/#guild_id/index.ts b/src/api/routes/guilds/#guild_id/index.ts
index 46346008..7c8f583e 100644
--- a/src/api/routes/guilds/#guild_id/index.ts
+++ b/src/api/routes/guilds/#guild_id/index.ts
@@ -34,28 +34,61 @@ import { HTTPError } from "lambert-server";
const router = Router();
-router.get("/", route({}), async (req: Request, res: Response) => {
- const { guild_id } = req.params;
-
- const [guild, member] = await Promise.all([
- Guild.findOneOrFail({ where: { id: guild_id } }),
- Member.findOne({ where: { guild_id: guild_id, id: req.user_id } }),
- ]);
- if (!member)
- throw new HTTPError(
- "You are not a member of the guild you are trying to access",
- 401,
- );
-
- return res.send({
- ...guild,
- joined_at: member?.joined_at,
- });
-});
+router.get(
+ "/",
+ route({
+ responses: {
+ "200": {
+ body: "GuildResponse",
+ },
+ 401: {
+ body: "APIErrorResponse",
+ },
+ 404: {
+ body: "APIErrorResponse",
+ },
+ },
+ }),
+ async (req: Request, res: Response) => {
+ const { guild_id } = req.params;
+
+ const [guild, member] = await Promise.all([
+ Guild.findOneOrFail({ where: { id: guild_id } }),
+ Member.findOne({ where: { guild_id: guild_id, id: req.user_id } }),
+ ]);
+ if (!member)
+ throw new HTTPError(
+ "You are not a member of the guild you are trying to access",
+ 401,
+ );
+
+ return res.send({
+ ...guild,
+ joined_at: member?.joined_at,
+ });
+ },
+);
router.patch(
"/",
- route({ requestBody: "GuildUpdateSchema", permission: "MANAGE_GUILD" }),
+ route({
+ requestBody: "GuildUpdateSchema",
+ permission: "MANAGE_GUILD",
+ responses: {
+ "200": {
+ body: "GuildUpdateSchema",
+ },
+ 401: {
+ body: "APIErrorResponse",
+ },
+ 403: {
+ body: "APIErrorResponse",
+ },
+ 404: {
+ body: "APIErrorResponse",
+ },
+ },
+ }),
async (req: Request, res: Response) => {
const body = req.body as GuildUpdateSchema;
const { guild_id } = req.params;
|