feat: support searching with index

This commit is contained in:
wonderlandpark 2021-05-22 16:13:30 +09:00
parent a2c115d62b
commit 273bed7e0c

View File

@ -10,7 +10,7 @@ const BotSubmit = RequestHandler()
const bot = await get.BotAuthorization(req.headers.authorization)
if(bot !== DiscordBot.user.id) return ResponseWrapper(res, { code: 403 })
const submits = await get.botSubmitList()
const submit = submits.find(el => el.id === req.query.id)
const submit = submits.find((el, n) => el.id === req.query.id || n+1 === Number(req.query.id))
if(!submit) return ResponseWrapper(res, { code: 404 })
return ResponseWrapper(res, { code: 200, data: submit })
})