diff --git a/controllers/updateController.go b/controllers/updateController.go index 8513bad..76a7e02 100644 --- a/controllers/updateController.go +++ b/controllers/updateController.go @@ -320,7 +320,7 @@ func UpdateStudentPassword(c *fiber.Ctx) error { }, } - result, updateErr := studentCollection.UpdateOne( + _, updateErr := studentCollection.UpdateOne( ctx, bson.M{"schooldata.sid": claims.Issuer}, update, @@ -350,7 +350,6 @@ func UpdateStudentPassword(c *fiber.Ctx) error { return c.Status(fiber.StatusOK).JSON(fiber.Map{ "success": true, "message": "successfully updated student password", - "result": result, }) } @@ -935,6 +934,14 @@ func UpdateStudentEmail(c *fiber.Ctx) error { }) } + if verifiedAdmin && data["sid"] == "" { + cancel() + return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{ + "success": false, + "message": "missing required fields", + }) + } + // Check required fields are included if data["email"] == "" { cancel()