fix: re routing patch topic

This commit is contained in:
2026-02-09 10:21:41 +07:00
parent ee710254e7
commit 90d4251ff6
+12 -3
View File
@@ -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)