diff --git a/src/api.ts b/src/api.ts index 706c522..e744483 100644 --- a/src/api.ts +++ b/src/api.ts @@ -102,7 +102,7 @@ router.delete('/pool', (req, res) => {}); router.get('/group', (req, res) => { if (typeof req.query.groupID != 'string') { - return; + return res.json({ status: 'error' }); } let groupID = req.query.groupID; @@ -115,6 +115,17 @@ router.get('/group', (req, res) => { } }); +router.get('/group_pools', async (req, res) => { + if (typeof req.query.groupID != 'string') { + return; + } + + let groupID = req.query.groupID; + let pools = await PoolModel.find({ group_id: groupID }).exec(); + + res.json({ status: 'success', data: pools }); +}); + router.post('/join_pool', async (req, res) => { if (!req.session.accountID) { return res.json({ status: 'error', error: 'need_login' });