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)