Merge branch 'master' of https://github.com/SowinskiBraeden/school-management-api
This commit is contained in:
2 files changed
+604
-57
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user