From 316b27e3e011a0c0b4ce88ea579290807b8927c5 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Wed, 19 Mar 2025 17:17:18 -0500 Subject: [PATCH] refactor(settings): used the common response function created --- .../server/route/settings/addSetting.ts | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/server/services/server/route/settings/addSetting.ts b/server/services/server/route/settings/addSetting.ts index a0d12b3..2e0c44e 100644 --- a/server/services/server/route/settings/addSetting.ts +++ b/server/services/server/route/settings/addSetting.ts @@ -4,6 +4,7 @@ import {addSetting} from "../../controller/settings/addSetting.js"; import {verify} from "hono/jwt"; import type {User} from "../../../../types/users.js"; import {authMiddleware} from "../../../auth/middleware/authMiddleware.js"; +import {responses} from "../../../../globalUtils/routeDefs/responses.js"; const app = new OpenAPIHono(); @@ -29,43 +30,7 @@ app.openapi( }, }, }, - responses: { - 200: { - content: { - "application/json": { - schema: z.object({ - success: z.boolean().openapi({example: true}), - message: z.string().openapi({example: "Starter"}), - }), - }, - }, - description: "Response message", - }, - 400: { - content: { - "application/json": { - schema: z.object({message: z.string().optional().openapi({example: "Internal Server error"})}), - }, - }, - description: "Internal Server Error", - }, - 401: { - content: { - "application/json": { - schema: z.object({message: z.string().optional().openapi({example: "Unauthenticated"})}), - }, - }, - description: "Unauthorized", - }, - 500: { - content: { - "application/json": { - schema: z.object({message: z.string().optional().openapi({example: "Internal Server error"})}), - }, - }, - description: "Internal Server Error", - }, - }, + responses: responses(), }), async (c) => { // make sure we have a vaid user being accessed thats really logged in