From 90d4251ff62a0f1823419771fc6a957290e5a7c2 Mon Sep 17 00:00:00 2001 From: NurAlan Date: Mon, 9 Feb 2026 10:21:41 +0700 Subject: [PATCH] fix: re routing patch topic --- src/modules/topics/router.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/topics/router.ts b/src/modules/topics/router.ts index c968d05..1fa22cc 100644 --- a/src/modules/topics/router.ts +++ b/src/modules/topics/router.ts @@ -1,6 +1,6 @@ import { Elysia } from 'elysia' import CommandService from './commands/service' -import { listTopicResponseSchema, listTopics, postDeleteTopic, postDeleteTopicResponseSchema } from './schema' +import { listTopicResponseSchema, listTopics, patchTopic, postDeleteTopic, postDeleteTopicResponseSchema } from './schema' import QueryService from './queries/service' import { basicAuthMacro } from '../../middlewares/basicAuth' @@ -46,8 +46,17 @@ export const router = new Elysia({ response: postDeleteTopicResponseSchema, verifyBasicAuth: true, }) - .patch('/', () => { - return 'Topics' + .patch('/', async ({ body, set }) => { + const result = await CommandService.patchTopic(body) + if (result.status != 200) { + set.status = result.status + return result + } + return result + }, { + verifyBasicAuth: true, + body: patchTopic, + response: postDeleteTopicResponseSchema, }) .delete('/', async ({ body, set }) => { const result = await CommandService.delTopic(body)