Skip to content

Commit 2968342

Browse files
committed
update docs
1 parent 12296b8 commit 2968342

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

src/api/index.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ async function init(prettyPrint: boolean = false, initClients: boolean = true) {
100100
return event.requestContext.requestId;
101101
},
102102
});
103+
if (!process.env.RunEnvironment) {
104+
process.env.RunEnvironment = "dev";
105+
}
106+
app.runEnvironment = process.env.RunEnvironment as RunEnvironment;
107+
app.environmentConfig =
108+
environmentConfig[app.runEnvironment as RunEnvironment];
103109
app.setValidatorCompiler(validatorCompiler);
104110
app.setSerializerCompiler(serializerCompiler);
105111

@@ -111,8 +117,9 @@ async function init(prettyPrint: boolean = false, initClients: boolean = true) {
111117
openapi: {
112118
info: {
113119
title: "ACM @ UIUC Core API",
114-
description: "ACM @ UIUC Core Management Platform",
115-
version: "1.0.0",
120+
description:
121+
"The ACM @ UIUC Core API provides services for managing chapter operations.",
122+
version: "1.1.0",
116123
contact: {
117124
name: "ACM @ UIUC Infrastructure Team",
118125
@@ -127,12 +134,8 @@ async function init(prettyPrint: boolean = false, initClients: boolean = true) {
127134
},
128135
servers: [
129136
{
130-
url: "https://core.acm.illinois.edu",
131-
description: "Production API server",
132-
},
133-
{
134-
url: "https://core.aws.qa.acmuiuc.org",
135-
description: "QA API server",
137+
url: app.environmentConfig.UserFacingUrl,
138+
description: "Main API server",
136139
},
137140
],
138141

@@ -215,6 +218,7 @@ async function init(prettyPrint: boolean = false, initClients: boolean = true) {
215218
});
216219
isSwaggerServer = true;
217220
} catch (e) {
221+
app.log.error(e);
218222
app.log.warn("Fastify Swagger not created!");
219223
}
220224
}
@@ -229,9 +233,6 @@ async function init(prettyPrint: boolean = false, initClients: boolean = true) {
229233
root: path.join(__dirname, "public"),
230234
prefix: "/",
231235
});
232-
if (!process.env.RunEnvironment) {
233-
process.env.RunEnvironment = "dev";
234-
}
235236
if (isRunningInLambda && !isSwaggerServer) {
236237
// Serve docs from S3
237238
app.get("/api/documentation", (_request, response) => {
@@ -264,9 +265,6 @@ async function init(prettyPrint: boolean = false, initClients: boolean = true) {
264265
"Audit logging to Dynamo is disabled! Audit log statements will be logged to the console.",
265266
);
266267
}
267-
app.runEnvironment = process.env.RunEnvironment as RunEnvironment;
268-
app.environmentConfig =
269-
environmentConfig[app.runEnvironment as RunEnvironment];
270268
app.nodeCache = new NodeCache({ checkperiod: 30 });
271269
if (initClients) {
272270
app.dynamoClient = new DynamoDBClient({

src/api/routes/events.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,11 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
473473
withTags(["Events"], {
474474
body: postRequestSchema,
475475
summary: "Create a calendar event.",
476+
response: {
477+
201: {
478+
description: "New event created.",
479+
},
480+
},
476481
}),
477482
) satisfies FastifyZodOpenApiSchema,
478483
onRequest: fastify.authorizeFromSchema,
@@ -583,12 +588,11 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
583588
example: "6667e095-8b04-4877-b361-f636f459ba42",
584589
}),
585590
}),
586-
// response: {
587-
// 201: z.object({
588-
// id: z.string(),
589-
// resource: z.string(),
590-
// }),
591-
// },
591+
response: {
592+
204: {
593+
description: "Event deleted.",
594+
},
595+
},
592596
summary: "Delete a calendar event.",
593597
}),
594598
) satisfies FastifyZodOpenApiSchema,
@@ -690,7 +694,14 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
690694
includeMetadata: zodIncludeMetadata,
691695
}),
692696
summary: "Retrieve a calendar event.",
693-
// response: { 200: getEventSchema },
697+
response: {
698+
200: {
699+
description: "Data from a calendar event.",
700+
content: {
701+
"application/json": { schema: postRequestSchema },
702+
},
703+
},
704+
},
694705
}),
695706
},
696707
async (request, reply) => {

src/api/routes/linkry.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
8282
{
8383
schema: withRoles(
8484
[AppRoles.LINKS_MANAGER, AppRoles.LINKS_ADMIN],
85-
withTags(["Linkry"], {}),
85+
withTags(["Linkry"], {
86+
summary: "Get all short links that a user can manage.",
87+
}),
8688
),
8789
onRequest: fastify.authorizeFromSchema,
8890
},
@@ -178,6 +180,7 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
178180
[AppRoles.LINKS_MANAGER, AppRoles.LINKS_ADMIN],
179181
withTags(["Linkry"], {
180182
body: createRequest,
183+
summary: "Create a short link for a long URL.",
181184
}),
182185
),
183186
preValidation: async (request, reply) => {
@@ -463,6 +466,7 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
463466
params: z.object({
464467
slug: linkrySlug,
465468
}),
469+
summary: "Get short link information.",
466470
}),
467471
),
468472
onRequest: fastify.authorizeFromSchema,
@@ -515,6 +519,7 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
515519
params: z.object({
516520
slug: linkrySlug,
517521
}),
522+
summary: "Delete a short link.",
518523
}),
519524
),
520525
onRequest: async (request, reply) => {

src/api/routes/organizations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { AllOrganizationList } from "@acm-uiuc/js-shared";
33
import fastifyCaching from "@fastify/caching";
44
import rateLimiter from "api/plugins/rateLimiter.js";
55
import { withTags } from "api/components/index.js";
6+
import * as z from "zod/v4";
67

78
const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
89
fastify.register(fastifyCaching, {
@@ -20,6 +21,11 @@ const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
2021
{
2122
schema: withTags(["Generic"], {
2223
summary: "Get a list of ACM @ UIUC sub-organizations.",
24+
response: {
25+
200: z.array(z.enum(AllOrganizationList)).meta({
26+
example: JSON.stringify(AllOrganizationList),
27+
}),
28+
},
2329
}),
2430
},
2531
async (_request, reply) => {

0 commit comments

Comments
 (0)