This commit is contained in:
SowinskiBraeden committed 2022-06-10 14:09:22 -07:00
commit dcabacdc8c
2 files changed
+604 -57

No files matched your search

+13 -9
View File
@@ -145,7 +145,7 @@ func UpdateStudentGradeLevel(c *fiber.Ctx) error {
},
}
result, updateErr := studentCollection.UpdateOne(
_, updateErr := studentCollection.UpdateOne(
ctx,
bson.M{"schooldata.sid": data["sid"].(string)},
update,
@@ -162,8 +162,7 @@ func UpdateStudentGradeLevel(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(fiber.Map{
"success": true,
"message": "successfully updated student",
"result": result,
"message": "successfully updated student"
})
}
@@ -217,7 +216,7 @@ func UpdateStudentHomeroom(c *fiber.Ctx) error {
},
}
result, updateErr := studentCollection.UpdateOne(
_, updateErr := studentCollection.UpdateOne(
ctx,
bson.M{"schooldata.sid": data["sid"]},
update,
@@ -235,7 +234,6 @@ func UpdateStudentHomeroom(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(fiber.Map{
"success": true,
"message": "successfully updated student",
"result": result,
})
}
@@ -322,7 +320,7 @@ func UpdateStudentPassword(c *fiber.Ctx) error {
},
}
result, updateErr := studentCollection.UpdateOne(
_, updateErr := studentCollection.UpdateOne(
ctx,
bson.M{"schooldata.sid": claims.Issuer},
update,
@@ -352,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,
})
}
@@ -491,7 +488,7 @@ func UpdateStudentLocker(c *fiber.Ctx) error {
},
}
result, updateErr := studentCollection.UpdateOne(
_, updateErr := studentCollection.UpdateOne(
ctx,
bson.M{"schooldata.sid": data["sid"]},
update,
@@ -509,7 +506,6 @@ func UpdateStudentLocker(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(fiber.Map{
"success": true,
"message": "successfully updated student",
"result": result,
})
}
@@ -936,6 +932,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()