fix: re routing patch topic
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { Elysia } from 'elysia'
|
import { Elysia } from 'elysia'
|
||||||
import CommandService from './commands/service'
|
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 QueryService from './queries/service'
|
||||||
import { basicAuthMacro } from '../../middlewares/basicAuth'
|
import { basicAuthMacro } from '../../middlewares/basicAuth'
|
||||||
|
|
||||||
@@ -46,8 +46,17 @@ export const router = new Elysia({
|
|||||||
response: postDeleteTopicResponseSchema,
|
response: postDeleteTopicResponseSchema,
|
||||||
verifyBasicAuth: true,
|
verifyBasicAuth: true,
|
||||||
})
|
})
|
||||||
.patch('/', () => {
|
.patch('/', async ({ body, set }) => {
|
||||||
return 'Topics'
|
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 }) => {
|
.delete('/', async ({ body, set }) => {
|
||||||
const result = await CommandService.delTopic(body)
|
const result = await CommandService.delTopic(body)
|
||||||
|
|||||||
Reference in New Issue
Block a user