fix: re routing patch topic
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user