geofence model changes to include assignment property
This commit is contained in:
@@ -139,9 +139,11 @@ export const getAssignmentByIdHandler = async (req, res) => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const assignment = await aggregateAssignment(pipeline)[0];
|
const assignment = await aggregateAssignment(pipeline);
|
||||||
|
|
||||||
res.status(200).json({ result: assignment });
|
console.log("ASSIGNMENT", assignment);
|
||||||
|
|
||||||
|
res.status(200).json({ result: assignment[0] });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ message: "Error getting assignment", error });
|
res.status(500).json({ message: "Error getting assignment", error });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ const geofenceSchema = new Schema({
|
|||||||
required: false,
|
required: false,
|
||||||
ref: "venue",
|
ref: "venue",
|
||||||
},
|
},
|
||||||
|
assignment: {
|
||||||
|
type: Types.ObjectId,
|
||||||
|
required: false,
|
||||||
|
ref: "assignment",
|
||||||
|
},
|
||||||
action: {
|
action: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const router = new Router();
|
|||||||
|
|
||||||
router.post("/", authorize("assignment", "write"), createAssignmentHandler);
|
router.post("/", authorize("assignment", "write"), createAssignmentHandler);
|
||||||
router.patch("/:id", authorize("assignment", "write"), updateAssignmentHandler);
|
router.patch("/:id", authorize("assignment", "write"), updateAssignmentHandler);
|
||||||
router.patch("/:id", authorize("assignment", "read"), getAssignmentByIdHandler);
|
router.get("/:id", authorize("assignment", "read"), getAssignmentByIdHandler);
|
||||||
router.get(
|
router.get(
|
||||||
"/user/:id",
|
"/user/:id",
|
||||||
authorize("assignment", "read"),
|
authorize("assignment", "read"),
|
||||||
|
|||||||
Reference in New Issue
Block a user