mirror of
https://github.com/myfatemi04/wheelshare-old-backend.git
synced 2025-04-21 12:10:17 -04:00
Add querying pools by group ID
This commit is contained in:
parent
0d53ed2352
commit
ad7f746d88
13
src/api.ts
13
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' });
|
||||
|
|
Loading…
Reference in New Issue
Block a user