fix db queries
This commit is contained in:
8 files changed
+61
-61
No files matched your search
@@ -34,7 +34,7 @@ type Admin struct {
|
||||
|
||||
func (a *Admin) EmailExists(email string) bool {
|
||||
var admin Admin
|
||||
findErr := AdminCollection.FindOne(context.TODO(), bson.M{"Account.schoolemail": email}).Decode(&admin)
|
||||
findErr := AdminCollection.FindOne(context.TODO(), bson.M{"account.schoolemail": email}).Decode(&admin)
|
||||
return findErr == nil
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ type Student struct {
|
||||
Postal string `json:"postal"`
|
||||
DOB string `json:"dob" validate:"required"`
|
||||
Contacts []string `json:"contacts"` // List of contact ID's rather than contact object
|
||||
} `json:"Personal"`
|
||||
} `json:"personal"`
|
||||
School struct {
|
||||
GradeLevel float64 `json:"gradelevel" validate:"required"`
|
||||
SID string `json:"sid"` // Student ID
|
||||
@@ -75,7 +75,7 @@ func (s *Student) HashPassword(password string) string {
|
||||
|
||||
func (s *Student) EmailExists(email string) bool {
|
||||
var student Student
|
||||
findErr := StudentCollection.FindOne(context.TODO(), bson.M{"Account.schoolemail": email}).Decode(&student)
|
||||
findErr := StudentCollection.FindOne(context.TODO(), bson.M{"account.schoolemail": email}).Decode(&student)
|
||||
return findErr == nil
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ type Teacher struct {
|
||||
Province string `json:"province"`
|
||||
Postal string `json:"postal"`
|
||||
DOB string `json:"dob" validate:"required"`
|
||||
} `json:"Personal"`
|
||||
} `json:"personal"`
|
||||
School struct {
|
||||
TID string `json:"tid"` // Teacher ID
|
||||
Homeroom string `json:"homeroom"`
|
||||
@@ -73,7 +73,7 @@ func (t *Teacher) HashPassword(password string) string {
|
||||
|
||||
func (t *Teacher) EmailExists(email string) bool {
|
||||
var teacher Teacher
|
||||
findErr := TeacherCollection.FindOne(context.TODO(), bson.M{"Account.schoolemail": email}).Decode(&teacher)
|
||||
findErr := TeacherCollection.FindOne(context.TODO(), bson.M{"account.schoolemail": email}).Decode(&teacher)
|
||||
return findErr == nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user