Add querying pools by group ID

This commit is contained in:
Michael Fatemi 2021-04-10 20:34:15 -04:00
parent 0d53ed2352
commit ad7f746d88

View File

@ -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' });