Add to the Circuit

Remove to the Circuit
Revoke request
Users Admins
This commit is contained in:
paoloar77
2022-09-02 02:25:38 +02:00
parent f55d69b7fe
commit 6bee366547
20 changed files with 598 additions and 274 deletions

View File

@@ -45,23 +45,24 @@ router.post('/load', authenticate, async (req, res) => {
const whatshow = Circuit.getWhatToShow(idapp, req.user.username);
let data = await Circuit.findOne({idapp, path}, whatshow).lean();
let cities = [];
const whatshowUsers = await User.getWhatToShow_IfFriends(idapp, req.user.username);
let users_in_circuit = [];
if (data && data.circuitId) {
if (data) {
users_in_circuit = await User.find(
{
idapp,
circuitId: data.circuitId,
'profile.mycircuits': {
$elemMatch: {circuitname: {$eq: data.name}},
},
},
whatshowUsers,
).lean();
}
data = await getCircuitRecAdminsInfo(idapp, data);
const whatshowUsers = await User.getWhatToShow_IfFriends(idapp, req.user.username);
res.send({circuit: data, users_in_circuit});
} catch (e) {