transfer update controllers to own files

This commit is contained in:
SowinskiBraeden committed 2022-08-14 11:49:01 -07:00
1 parent 1b643c0bc2
commit d7d19ffb2d
11 files changed
+2708 -2651

No files matched your search

+3 -3
View File
@@ -18,8 +18,8 @@ import (
"go.mongodb.org/mongo-driver/mongo"
)
var lockerCollection *mongo.Collection = database.OpenCollection(database.Client, "lockers")
var studentCollection *mongo.Collection = database.OpenCollection(database.Client, "students")
var LockerCollection *mongo.Collection = database.OpenCollection(database.Client, "lockers")
var StudentCollection *mongo.Collection = database.OpenCollection(database.Client, "students")
type Student struct {
ID primitive.ObjectID `bson:"_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{"accountdata.schoolemail": email}).Decode(&student)
findErr := StudentCollection.FindOne(context.TODO(), bson.M{"accountdata.schoolemail": email}).Decode(&student)
if findErr != nil {
return false
}
+2 -2
View File
@@ -24,7 +24,7 @@ var (
allCharSet = lowerCharSet + upperCharSet + specialCharSet + numberSet
)
var teacherCollection *mongo.Collection = database.OpenCollection(database.Client, "teachers")
var TeacherCollection *mongo.Collection = database.OpenCollection(database.Client, "teachers")
type Teacher struct {
ID primitive.ObjectID `bson:"_id"`
@@ -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{"accountdata.schoolemail": email}).Decode(&teacher)
findErr := TeacherCollection.FindOne(context.TODO(), bson.M{"accountdata.schoolemail": email}).Decode(&teacher)
if findErr != nil {
return false
}