Skip to content

Commit f969739

Browse files
committed
WORKING VERSION
1 parent 0b575da commit f969739

File tree

9 files changed

+36
-39
lines changed

9 files changed

+36
-39
lines changed

src/api/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint import/no-nodejs-modules: ["error", {"allow": ["crypto"]}] */
2+
import "zod-openapi/extend";
23
import { randomUUID } from "crypto";
34
import fastify, { FastifyInstance } from "fastify";
45
import FastifyAuthProvider from "@fastify/auth";
@@ -35,10 +36,11 @@ import {
3536
fastifyZodOpenApiPlugin,
3637
fastifyZodOpenApiTransform,
3738
fastifyZodOpenApiTransformObject,
39+
serializerCompiler,
40+
validatorCompiler,
3841
} from "fastify-zod-openapi";
3942
import { ZodOpenApiVersion } from "zod-openapi";
4043
import { withTags } from "./components/index.js";
41-
import "zod-openapi/extend";
4244

4345
dotenv.config();
4446

@@ -91,6 +93,8 @@ async function init(prettyPrint: boolean = false) {
9193
return event.requestContext.requestId;
9294
},
9395
});
96+
app.setValidatorCompiler(validatorCompiler);
97+
app.setSerializerCompiler(serializerCompiler);
9498
await app.register(fastifyAuthPlugin);
9599
await app.register(fastifyZodValidationPlugin);
96100
await app.register(FastifyAuthProvider);

src/api/lambda.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@
33
import "zod-openapi/extend";
44
import awsLambdaFastify from "@fastify/aws-lambda";
55
import init from "./index.js";
6-
import {
7-
serializerCompiler,
8-
validatorCompiler,
9-
ZodTypeProvider,
10-
} from "fastify-type-provider-zod";
116

127
const app = await init();
13-
app.setValidatorCompiler(validatorCompiler);
14-
app.setSerializerCompiler(serializerCompiler);
158
const handler = awsLambdaFastify(app, {
169
decorateRequest: false,
1710
serializeLambdaArguments: true,

src/api/routes/events.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
110110
.openapi({ description: "Event host filter." }),
111111
ts,
112112
}),
113-
response: { 200: getEventsSchema },
113+
// response: { 200: getEventsSchema },
114114
}),
115115
},
116116
async (request, reply) => {
@@ -223,12 +223,12 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
223223
"/:id?",
224224
{
225225
schema: withTags(["Events"], {
226-
response: {
227-
201: z.object({
228-
id: z.string(),
229-
resource: z.string(),
230-
}),
231-
},
226+
// response: {
227+
// 201: z.object({
228+
// id: z.string(),
229+
// resource: z.string(),
230+
// }),
231+
// },
232232
body: postRequestSchema,
233233
}) satisfies FastifyZodOpenApiSchema,
234234
onRequest: async (request, reply) => {
@@ -363,12 +363,12 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
363363
example: "6667e095-8b04-4877-b361-f636f459ba42",
364364
}),
365365
}),
366-
response: {
367-
201: z.object({
368-
id: z.string(),
369-
resource: z.string(),
370-
}),
371-
},
366+
// response: {
367+
// 201: z.object({
368+
// id: z.string(),
369+
// resource: z.string(),
370+
// }),
371+
// },
372372
}) satisfies FastifyZodOpenApiSchema,
373373
onRequest: async (request, reply) => {
374374
await fastify.authorize(request, reply, [AppRoles.EVENTS_MANAGER]);
@@ -437,7 +437,7 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
437437
querystring: z.object({
438438
ts,
439439
}),
440-
response: { 200: getEventSchema },
440+
// response: { 200: getEventSchema },
441441
}),
442442
},
443443
async (request, reply) => {

src/api/routes/iam.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
202202
{
203203
schema: withTags(["IAM"], {
204204
body: invitePostRequestSchema,
205-
response: { 202: entraActionResponseSchema },
205+
// response: { 202: entraActionResponseSchema },
206206
}),
207207
onRequest: async (request, reply) => {
208208
await fastify.authorize(request, reply, [AppRoles.IAM_INVITE_ONLY]);
@@ -424,7 +424,7 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
424424
"/groups/:groupId",
425425
{
426426
schema: withTags(["IAM"], {
427-
response: { 200: entraGroupMembershipListResponse },
427+
// response: { 200: entraGroupMembershipListResponse },
428428
params: z.object({
429429
groupId,
430430
}),

src/api/routes/logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const logsPlugin: FastifyPluginAsync = async (fastify, _options) => {
5656
.nativeEnum(Modules)
5757
.openapi({ description: "Module to get audit logs for." }),
5858
}),
59-
response: { 200: responseSchema },
59+
// response: { 200: responseSchema },
6060
}),
6161
onRequest: async (request, reply) => {
6262
await fastify.authorize(request, reply, [AppRoles.AUDIT_LOG_VIEWER]);

src/api/routes/mobileWallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const mobileWalletRoute: FastifyPluginAsync = async (fastify, _options) => {
3131
"/membership",
3232
{
3333
schema: {
34-
response: { 202: queuedResponseJsonSchema },
34+
// response: { 202: queuedResponseJsonSchema },
3535
querystring: {
3636
type: "object",
3737
properties: {

src/api/routes/roomRequests.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
148148
"/:semesterId",
149149
{
150150
schema: {
151-
response: {
152-
200: zodToJsonSchema(roomGetResponse),
153-
},
151+
// response: {
152+
// 200: zodToJsonSchema(roomGetResponse),
153+
// },
154154
},
155155
onRequest: async (request, reply) => {
156156
await fastify.authorize(request, reply, [AppRoles.ROOM_REQUEST_CREATE]);
@@ -242,7 +242,7 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
242242
"/",
243243
{
244244
schema: {
245-
response: { 201: zodToJsonSchema(roomRequestPostResponse) },
245+
// response: { 201: zodToJsonSchema(roomRequestPostResponse) },
246246
},
247247
preValidation: async (request, reply) => {
248248
await fastify.zodValidateBody(request, reply, roomRequestSchema);

src/api/routes/stripe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const stripeRoutes: FastifyPluginAsync = async (fastify, _options) => {
3333
"/paymentLinks",
3434
{
3535
schema: {
36-
response: { 200: zodToJsonSchema(invoiceLinkGetResponseSchema) },
36+
// response: { 200: zodToJsonSchema(invoiceLinkGetResponseSchema) },
3737
},
3838
onRequest: async (request, reply) => {
3939
await fastify.authorize(request, reply, [AppRoles.STRIPE_LINK_CREATOR]);
@@ -88,7 +88,7 @@ const stripeRoutes: FastifyPluginAsync = async (fastify, _options) => {
8888
"/paymentLinks",
8989
{
9090
schema: {
91-
response: { 201: zodToJsonSchema(invoiceLinkPostResponseSchema) },
91+
// response: { 201: zodToJsonSchema(invoiceLinkPostResponseSchema) },
9292
},
9393
preValidation: async (request, reply) => {
9494
await fastify.zodValidateBody(

src/api/routes/tickets.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
120120
"/",
121121
{
122122
schema: {
123-
response: {
124-
200: listMerchItemsResponseJsonSchema,
125-
},
123+
// response: {
124+
// 200: listMerchItemsResponseJsonSchema,
125+
// },
126126
},
127127
onRequest: async (request, reply) => {
128128
await fastify.authorize(request, reply, [
@@ -226,9 +226,9 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
226226
},
227227
},
228228
},
229-
response: {
230-
200: getTicketsResponseJsonSchema,
231-
},
229+
// response: {
230+
// 200: getTicketsResponseJsonSchema,
231+
// },
232232
},
233233
onRequest: async (request, reply) => {
234234
await fastify.authorize(request, reply, [AppRoles.TICKETS_MANAGER]);
@@ -349,7 +349,7 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
349349
"/checkIn",
350350
{
351351
schema: {
352-
response: { 200: responseJsonSchema },
352+
// response: { 200: responseJsonSchema },
353353
},
354354
preValidation: async (request, reply) => {
355355
await fastify.zodValidateBody(request, reply, postSchema);

0 commit comments

Comments
 (0)