mirror of
https://github.com/koreanbots/core.git
synced 2025-12-17 06:40:24 +00:00
feat: added query aliases
This commit is contained in:
parent
435ef2ddf6
commit
c4a8e21b4d
@ -8,7 +8,7 @@ import { SearchQuerySchema } from '@utils/Yup'
|
|||||||
import { BotList } from '@types'
|
import { BotList } from '@types'
|
||||||
|
|
||||||
const SearchBots = RequestHandler().get(async (req: ApiRequest, res: NextApiResponse) => {
|
const SearchBots = RequestHandler().get(async (req: ApiRequest, res: NextApiResponse) => {
|
||||||
const validated = await SearchQuerySchema.validate({ q: req.query.q, page: req.query.page })
|
const validated = await SearchQuerySchema.validate({ q: req.query.q || req.query.query, page: req.query.page })
|
||||||
.then(el => el)
|
.then(el => el)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
ResponseWrapper(res, { code: 400, errors: e.errors })
|
ResponseWrapper(res, { code: 400, errors: e.errors })
|
||||||
@ -30,7 +30,8 @@ const SearchBots = RequestHandler().get(async (req: ApiRequest, res: NextApiResp
|
|||||||
|
|
||||||
interface ApiRequest extends NextApiRequest {
|
interface ApiRequest extends NextApiRequest {
|
||||||
query: {
|
query: {
|
||||||
q: string
|
q?: string
|
||||||
|
query?: string
|
||||||
page: string
|
page: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user