Operational Endpoints for Admin, Products, Assignments, Location, Vendor, Venue completed. Geofence Testing PEnding

This commit is contained in:
Shibi Chakkaravarthy
2026-06-14 08:04:31 +05:30
parent 5326235183
commit 36e1bf664f
26 changed files with 1392 additions and 25 deletions
+47
View File
@@ -3,6 +3,8 @@ import {
getLocationByQuery,
getLocationByRadius,
} from "../models/Location/operations";
import { aggregateAssignment } from "../models/Assignment/operations";
import { ObjectId } from "mongodb";
/*
Sample Location Payload
@@ -69,3 +71,48 @@ export const getLocationController = async (req, res) => {
res.status(500).json({ error: error.message });
}
};
export const getMyAssignedVenuesHandler = async (req, res, next) => {
try {
const { user } = res.locals;
const pipeline = [
{
$match: {
user: ObjectId?.createFromHexString(user.id),
isActive: true,
},
},
{
$lookup: {
from: "venues",
localField: "venue",
foreignField: "_id",
as: "venue",
},
},
{
$unwind: {
path: "$venue",
},
},
{
$lookup: {
from: "partners",
localField: "venue.entity",
foreignField: "_id",
as: "partner",
},
},
{
$unwind: {
path: "$partner",
},
},
];
const assignment = await aggregateAssignment(pipeline);
res.status(200).json({ result: assignment });
} catch (error) {
console.log("getMyAssignedVenuesHandler Error", error);
next(error);
}
};