simplify code

This commit is contained in:
SowinskiBraeden committed 2022-08-13 20:44:49 -07:00
1 parent 0f183559e5
commit 1b643c0bc2
3 files changed
+9 -20

No files matched your search

+2 -8
View File
@@ -29,10 +29,7 @@ func ValidateID(id string, userType int) bool { // true: valid id, false: id alr
newID.ParentType = userType
newID.ID = primitive.NewObjectID()
_, insertErr := idCollection.InsertOne(context.Background(), newID)
if insertErr != nil {
return false
}
return true
return insertErr == nil
}
return false
}
@@ -42,10 +39,7 @@ func ValidatePEN(pen string) bool { // true: valid pen, false: pen already in us
var foundID models.Id
err := studentCollection.FindOne(ctx, bson.M{"schooldata.pen": pen}).Decode(&foundID)
cancel()
if err != nil {
return true
}
return false
return err != nil
}
func GenerateID(length int) string {