From c73622744823927060bce857f36e0b2b9a93f69b Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 25 Oct 2025 16:52:11 +0200 Subject: [PATCH] Add response to send test email --- backend/api/src/app.ts | 85 +++++++++++++++++++++-------------------- backend/api/src/test.ts | 1 + 2 files changed, 45 insertions(+), 41 deletions(-) diff --git a/backend/api/src/app.ts b/backend/api/src/app.ts index 6fc4cc10..73a861b7 100644 --- a/backend/api/src/app.ts +++ b/backend/api/src/app.ts @@ -404,6 +404,48 @@ app.post(pathWithPrefix("/internal/send-search-notifications"), } ); +const responses = { + 200: { + description: "Request successful", + content: { + "application/json": { + schema: { + type: "object", + properties: { + status: { type: "string", example: "success" } + }, + }, + }, + }, + }, + 401: { + description: "Unauthorized (e.g., invalid or missing API key)", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { type: "string", example: "Unauthorized" }, + }, + }, + }, + }, + }, + 500: { + description: "Internal server error during request processing", + content: { + "application/json": { + schema: { + type: "object", + properties: { + error: { type: "string", example: "Internal server error" }, + }, + }, + }, + }, + }, +}; + swaggerDocument.paths["/internal/send-search-notifications"] = { post: { summary: "Trigger daily search notifications", @@ -418,47 +460,7 @@ swaggerDocument.paths["/internal/send-search-notifications"] = { requestBody: { required: false, }, - responses: { - 200: { - description: "Notifications sent successfully", - content: { - "application/json": { - schema: { - type: "object", - properties: { - status: { type: "string", example: "success" } - }, - }, - }, - }, - }, - 401: { - description: "Unauthorized (invalid or missing API key)", - content: { - "application/json": { - schema: { - type: "object", - properties: { - error: { type: "string", example: "Unauthorized" }, - }, - }, - }, - }, - }, - 500: { - description: "Internal server error during notification send", - content: { - "application/json": { - schema: { - type: "object", - properties: { - error: { type: "string", example: "Internal server error" }, - }, - }, - }, - }, - }, - }, + responses: responses, }, } as any @@ -486,6 +488,7 @@ swaggerDocument.paths["/local/send-test-email"] = { requestBody: { required: false, }, + responses: responses, }, } as any diff --git a/backend/api/src/test.ts b/backend/api/src/test.ts index c136b5c7..b960af34 100644 --- a/backend/api/src/test.ts +++ b/backend/api/src/test.ts @@ -4,4 +4,5 @@ export const localSendTestEmail = async () => { sendTestEmail('hello@compassmeet.com') .then(() => console.debug('Email sent successfully!')) .catch((error) => console.error('Failed to send email:', error)) + return { message: 'Email sent successfully!'} }