update/studentModel
This commit is contained in:
1 parent
0bf3910a20
commit
8b55d1df53
3 files changed
+32
-32
No files matched your search
@@ -95,7 +95,7 @@ func Enroll(c *fiber.Ctx) error {
|
||||
|
||||
student.SchoolData.YOG = ((12 - student.SchoolData.GradeLevel) + time.Now().Year()) + 1
|
||||
|
||||
student.SchoolData.SchoolEmail = student.GenerateSchoolEmail()
|
||||
student.AccountData.SchoolEmail = student.GenerateSchoolEmail()
|
||||
|
||||
// Disable login block
|
||||
student.AccountData.AccountDisabled = false
|
||||
@@ -103,7 +103,7 @@ func Enroll(c *fiber.Ctx) error {
|
||||
|
||||
// Generate temporary password
|
||||
tempPass := student.GeneratePassword(12, 1, 1, 1)
|
||||
student.SchoolData.Password = student.HashPassword(tempPass)
|
||||
student.AccountData.Password = student.HashPassword(tempPass)
|
||||
student.AccountData.TempPassword = true
|
||||
|
||||
// Send student personal email temp password
|
||||
|
||||
@@ -51,10 +51,10 @@ func UpdateStudentName(c *fiber.Ctx) error {
|
||||
update_time, _ := time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))
|
||||
update := bson.M{
|
||||
"$set": bson.M{
|
||||
"firstname": data["firstname"],
|
||||
"middlename": data["middlename"],
|
||||
"lastname": data["lastname"],
|
||||
"updated_at": update_time,
|
||||
"PersonalData.FirstName": data["firstname"],
|
||||
"PersonalData.middlename": data["middlename"],
|
||||
"PersonalData.lastname": data["lastname"],
|
||||
"updated_at": update_time,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ func UpdateStudentGradeLevel(c *fiber.Ctx) error {
|
||||
update_time, _ := time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))
|
||||
update := bson.M{
|
||||
"$set": bson.M{
|
||||
"gradelevel": data["gradelevel"],
|
||||
"updated_at": update_time,
|
||||
"SchoolData.gradelevel": data["gradelevel"],
|
||||
"updated_at": update_time,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -175,8 +175,8 @@ func UpdateStudentHomeroom(c *fiber.Ctx) error {
|
||||
update_time, _ := time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))
|
||||
update := bson.M{
|
||||
"$set": bson.M{
|
||||
"homeroom": data["homeroom"],
|
||||
"updated_at": update_time,
|
||||
"SchoolData.homeroom": data["homeroom"],
|
||||
"updated_at": update_time,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -268,9 +268,9 @@ func UpdateStudentPassword(c *fiber.Ctx) error {
|
||||
update_time, _ := time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))
|
||||
update := bson.M{
|
||||
"$set": bson.M{
|
||||
"password": student.HashPassword(data["newPassword1"]),
|
||||
"temppassword": false, // If it were a temp password, its not now
|
||||
"updated_at": update_time,
|
||||
"AccountData.password": student.HashPassword(data["newPassword1"]),
|
||||
"AccountData.temppassword": false, // If it were a temp password, its not now
|
||||
"updated_at": update_time,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -340,9 +340,9 @@ func ResetStudentPassword(c *fiber.Ctx) error {
|
||||
update_time, _ := time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))
|
||||
update := bson.M{
|
||||
"$set": bson.M{
|
||||
"password": student.HashPassword(tempPass),
|
||||
"temppassword": true,
|
||||
"updated_at": update_time,
|
||||
"AccountData.password": student.HashPassword(tempPass),
|
||||
"AccountData.temppassword": true,
|
||||
"updated_at": update_time,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -462,9 +462,9 @@ func RemoveStudentsDisabled(c *fiber.Ctx) error {
|
||||
update_time, _ := time.Parse(time.RFC3339, time.Now().Format(time.RFC3339))
|
||||
update := bson.M{
|
||||
"$set": bson.M{
|
||||
"accountdisabled": false,
|
||||
"attempts": 0,
|
||||
"updated_at": update_time,
|
||||
"AccountData.accountdisabled": false,
|
||||
"AccountData.attempts": 0,
|
||||
"updated_at": update_time,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user