From 06497112e18ee96bffea353a205076bd2f0569af Mon Sep 17 00:00:00 2001 From: jeffplays2005 Date: Mon, 7 Oct 2024 21:53:47 +1300 Subject: [PATCH] Remove extra comments and generate swagger --- client/src/models/__generated__/schema.d.ts | 68 ---------- .../src/data-layer/services/EventService.ts | 2 - server/src/middleware/__generated__/routes.ts | 89 ------------- .../src/middleware/__generated__/swagger.json | 123 ------------------ 4 files changed, 282 deletions(-) diff --git a/client/src/models/__generated__/schema.d.ts b/client/src/models/__generated__/schema.d.ts index bd43d15d..6959f962 100644 --- a/client/src/models/__generated__/schema.d.ts +++ b/client/src/models/__generated__/schema.d.ts @@ -52,10 +52,6 @@ export interface paths { */ post: operations["GetBookingPayment"]; }; - "/events/signup": { - /** @description Signs up for an event */ - post: operations["EventSignup"]; - }; "/events": { /** * @description Fetches latest events starting from the event with the latest starting date @@ -63,13 +59,6 @@ export interface paths { */ get: operations["GetAllEvents"]; }; - "/events/reservations/stream": { - /** - * @description Streams the signup count for active events signups. - * Note that when testing this on swagger, the connection will remain open. - */ - get: operations["StreamSignupCounts"]; - }; "/events/{id}": { get: operations["GetEventById"]; }; @@ -314,35 +303,6 @@ export interface components { /** @description Firestore timestamp, should represent a UTC date that is set to exactly midnight */ endDate?: components["schemas"]["FirebaseFirestore.Timestamp"]; }; - EventSignupResponse: { - error?: string; - message?: string; - data?: { - email: string; - last_name: string; - first_name: string; - }; - }; - /** @description From T, pick a set of properties whose keys are in the union K */ - "Pick_EventReservation.Exclude_keyofEventReservation.timestamp__": { - /** @description The first name of the user who made this event reservation */ - first_name: string; - /** @description The last name of the user who made this event reservation */ - last_name: string; - /** @description The email of the user who made this even reservation */ - email: string; - /** - * @description Boolean to check if the user is a member - * @example true - */ - is_member: boolean; - }; - /** @description Construct a type with the properties of T except for those in type K. */ - "Omit_EventReservation.timestamp_": components["schemas"]["Pick_EventReservation.Exclude_keyofEventReservation.timestamp__"]; - EventSignupBody: { - event_id: string; - reservation: components["schemas"]["Omit_EventReservation.timestamp_"]; - }; Event: { /** @description The title of this event */ title: string; @@ -972,22 +932,6 @@ export interface operations { }; }; }; - /** @description Signs up for an event */ - EventSignup: { - requestBody: { - content: { - "application/json": components["schemas"]["EventSignupBody"]; - }; - }; - responses: { - /** @description Successfully signed up for Event */ - 200: { - content: { - "application/json": components["schemas"]["EventSignupResponse"]; - }; - }; - }; - }; /** * @description Fetches latest events starting from the event with the latest starting date * (**NOT** the signup open date) based on limit. Is paginated with a cursor @@ -1008,18 +952,6 @@ export interface operations { }; }; }; - /** - * @description Streams the signup count for active events signups. - * Note that when testing this on swagger, the connection will remain open. - */ - StreamSignupCounts: { - responses: { - /** @description No content */ - 204: { - content: never; - }; - }; - }; GetEventById: { parameters: { path: { diff --git a/server/src/data-layer/services/EventService.ts b/server/src/data-layer/services/EventService.ts index 724862cf..35efea27 100644 --- a/server/src/data-layer/services/EventService.ts +++ b/server/src/data-layer/services/EventService.ts @@ -55,12 +55,10 @@ class EventService { /** * Deletes an existing event document by ID. - * Also deletes all reservation docs when deleting an event. * * @param eventId the ID of the event document */ public async deleteEvent(eventId: string) { - // Delete main collection doc after deleting reservations return await FirestoreCollections.events.doc(eventId).delete() } diff --git a/server/src/middleware/__generated__/routes.ts b/server/src/middleware/__generated__/routes.ts index e946a33f..5dc2290e 100644 --- a/server/src/middleware/__generated__/routes.ts +++ b/server/src/middleware/__generated__/routes.ts @@ -180,35 +180,6 @@ const models: TsoaRoute.Models = { "additionalProperties": false, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "EventSignupResponse": { - "dataType": "refObject", - "properties": { - "error": {"dataType":"string"}, - "message": {"dataType":"string"}, - "data": {"dataType":"nestedObjectLiteral","nestedProperties":{"email":{"dataType":"string","required":true},"last_name":{"dataType":"string","required":true},"first_name":{"dataType":"string","required":true}}}, - }, - "additionalProperties": false, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "Pick_EventReservation.Exclude_keyofEventReservation.timestamp__": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"first_name":{"dataType":"string","required":true},"last_name":{"dataType":"string","required":true},"email":{"dataType":"string","required":true},"is_member":{"dataType":"boolean","required":true}},"validators":{}}, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "Omit_EventReservation.timestamp_": { - "dataType": "refAlias", - "type": {"ref":"Pick_EventReservation.Exclude_keyofEventReservation.timestamp__","validators":{}}, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "EventSignupBody": { - "dataType": "refObject", - "properties": { - "event_id": {"dataType":"string","required":true}, - "reservation": {"ref":"Omit_EventReservation.timestamp_","required":true}, - }, - "additionalProperties": false, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Event": { "dataType": "refObject", "properties": { @@ -899,36 +870,6 @@ export function RegisterRoutes(app: Router) { } }); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - app.post('/events/signup', - ...(fetchMiddlewares(EventController)), - ...(fetchMiddlewares(EventController.prototype.eventSignup)), - - function EventController_eventSignup(request: ExRequest, response: ExResponse, next: any) { - const args: Record = { - requestBody: {"in":"body","name":"requestBody","required":true,"ref":"EventSignupBody"}, - }; - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args, request, response }); - - const controller = new EventController(); - - templateService.apiHandler({ - methodName: 'eventSignup', - controller, - response, - next, - validatedArgs, - successStatus: 200, - }); - } catch (err) { - return next(err); - } - }); - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa app.get('/events', ...(fetchMiddlewares(EventController)), ...(fetchMiddlewares(EventController.prototype.getAllEvents)), @@ -960,36 +901,6 @@ export function RegisterRoutes(app: Router) { } }); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - app.get('/events/reservations/stream', - ...(fetchMiddlewares(EventController)), - ...(fetchMiddlewares(EventController.prototype.streamSignupCounts)), - - function EventController_streamSignupCounts(request: ExRequest, response: ExResponse, next: any) { - const args: Record = { - req: {"in":"request","name":"req","required":true,"dataType":"object"}, - }; - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args, request, response }); - - const controller = new EventController(); - - templateService.apiHandler({ - methodName: 'streamSignupCounts', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } catch (err) { - return next(err); - } - }); - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa app.get('/events/:id', ...(fetchMiddlewares(EventController)), ...(fetchMiddlewares(EventController.prototype.getEventById)), diff --git a/server/src/middleware/__generated__/swagger.json b/server/src/middleware/__generated__/swagger.json index 5bccffd1..1e4812ef 100644 --- a/server/src/middleware/__generated__/swagger.json +++ b/server/src/middleware/__generated__/swagger.json @@ -395,86 +395,6 @@ "type": "object", "additionalProperties": false }, - "EventSignupResponse": { - "properties": { - "error": { - "type": "string" - }, - "message": { - "type": "string" - }, - "data": { - "properties": { - "email": { - "type": "string" - }, - "last_name": { - "type": "string" - }, - "first_name": { - "type": "string" - } - }, - "required": [ - "email", - "last_name", - "first_name" - ], - "type": "object" - } - }, - "type": "object", - "additionalProperties": false - }, - "Pick_EventReservation.Exclude_keyofEventReservation.timestamp__": { - "properties": { - "first_name": { - "type": "string", - "description": "The first name of the user who made this event reservation" - }, - "last_name": { - "type": "string", - "description": "The last name of the user who made this event reservation" - }, - "email": { - "type": "string", - "description": "The email of the user who made this even reservation" - }, - "is_member": { - "type": "boolean", - "description": "Boolean to check if the user is a member", - "example": true - } - }, - "required": [ - "first_name", - "last_name", - "email", - "is_member" - ], - "type": "object", - "description": "From T, pick a set of properties whose keys are in the union K" - }, - "Omit_EventReservation.timestamp_": { - "$ref": "#/components/schemas/Pick_EventReservation.Exclude_keyofEventReservation.timestamp__", - "description": "Construct a type with the properties of T except for those in type K." - }, - "EventSignupBody": { - "properties": { - "event_id": { - "type": "string" - }, - "reservation": { - "$ref": "#/components/schemas/Omit_EventReservation.timestamp_" - } - }, - "required": [ - "event_id", - "reservation" - ], - "type": "object", - "additionalProperties": false - }, "Event": { "properties": { "title": { @@ -1870,36 +1790,6 @@ } } }, - "/events/signup": { - "post": { - "operationId": "EventSignup", - "responses": { - "200": { - "description": "Successfully signed up for Event", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventSignupResponse" - } - } - } - } - }, - "description": "Signs up for an event", - "security": [], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventSignupBody" - } - } - } - } - } - }, "/events": { "get": { "operationId": "GetAllEvents", @@ -1939,19 +1829,6 @@ ] } }, - "/events/reservations/stream": { - "get": { - "operationId": "StreamSignupCounts", - "responses": { - "204": { - "description": "No content" - } - }, - "description": "Streams the signup count for active events signups.\nNote that when testing this on swagger, the connection will remain open.", - "security": [], - "parameters": [] - } - }, "/events/{id}": { "get": { "operationId": "GetEventById",