This commit is contained in:
syuilo
2018-03-17 03:33:36 +09:00
parent c38b5a9b8b
commit 128b56da28
6 changed files with 601 additions and 58 deletions

View File

@ -27,6 +27,10 @@ module.exports = (params) => new Promise(async (res, rej) => {
const [poll, pollErr] = $(params.poll).optional.boolean().$;
if (pollErr) return rej('invalid poll param');
// Get 'bot' parameter
//const [bot, botErr] = $(params.bot).optional.boolean().$;
//if (botErr) return rej('invalid bot param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
@ -76,6 +80,11 @@ module.exports = (params) => new Promise(async (res, rej) => {
query.poll = poll ? { $exists: true, $ne: null } : null;
}
// TODO
//if (bot != undefined) {
// query.is_bot = bot;
//}
// Issue query
const posts = await Post
.find(query, {