models

package
v0.0.0-...-10dc621 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdminCollection *mongo.Collection = database.OpenCollection(database.Client, "admins")
View Source
var LockerCollection *mongo.Collection = database.OpenCollection(database.Client, "lockers")
View Source
var StudentCollection *mongo.Collection = database.OpenCollection(database.Client, "students")
View Source
var TeacherCollection *mongo.Collection = database.OpenCollection(database.Client, "teachers")

Functions

This section is empty.

Types

type Admin

type Admin struct {
	ID           primitive.ObjectID `bson:"_id"`
	FirstName    string             `json:"firstname" validate:"required"`
	LastName     string             `json:"lastname" validate:"required"`
	Email        string             `json:"email" validate:"required"`
	SchoolEmail  string             `json:"schoolemail"`
	Password     string             `json:"-" validate:"min=10,max=32"`
	TempPassword bool               `json:"temppassword"`
	AID          string             `json:"aid"`
	Created_at   time.Time          `json:"created_at"`
	Updated_at   time.Time          `json:"updated_at"`
}

func (*Admin) CheckPasswordStrength

func (a *Admin) CheckPasswordStrength(password string) bool

func (*Admin) ComparePasswords

func (a *Admin) ComparePasswords(password string) bool

func (*Admin) EmailExists

func (a *Admin) EmailExists(email string) bool

func (*Admin) GeneratePassword

func (a *Admin) GeneratePassword(passwordLength, minSpecialChar, minNum, minUpperCase int) string

func (*Admin) GenerateSchoolEmail

func (a *Admin) GenerateSchoolEmail(offset int, lastEmail string) string

func (*Admin) HashPassword

func (s *Admin) HashPassword(password string) string

type Contact

type Contact struct {
	ID         primitive.ObjectID `bson:"_id"`
	FirstName  string             `json:"firstname" validate:"required"`
	MiddleName string             `json:"middlename"`
	LastName   string             `json:"lastname" validate:"required"`
	Province   string             `json:"province"`
	City       string             `json:"city"`
	Address    string             `json:"address" validate:"required"`
	Postal     string             `json:"postal"`
	HomePhone  float64            `json:"homephone" validate:"required"`
	WorkPhone  float64            `json:"workphone"`
	Email      string             `json:"email" validate:"required"`
	Relation   string             `json:"relation" validate:"required"`
	Priotrity  float64            `json:"priority" validate:"required"`
	Created_at time.Time          `json:"created_at"`
	Updated_at time.Time          `json:"updated_at"`
}

type Course

type Course struct {
	ID           primitive.ObjectID `bson:"_id"`
	Name         string             `json:"name" validate:"required"`
	Code         string             `json:"code" validate:"required"` // Short string to identify each class
	GradeLevel   int                `json:"gradelevel" validate:"required"`
	Credits      int                `json:"credits" default:"4"`
	TotalRequest int                `json:"totalRequest" default:"0"` // Amount of requests for this course
	Created_at   time.Time          `json:"created_at"`
	Updated_at   time.Time          `json:"updated_at"`
}

type Id

type Id struct {
	ID         primitive.ObjectID `bson:"_id"`
	CID        string             `json:"cid"`        // custom id for admin, teahcer or student
	ParentType int                `json:"parenttype"` // A number representing the user (1: student, 2: teacher, 3: admin)
}

type Locker

type Locker struct {
	ID           primitive.ObjectID `bson:"_id"`
	LockerNumber string             `json:"lockernumber"` // Example B123
	LockerCombo  string             `json:"lockercombo"`
	LockerType   string             `json:"lockertype"` // Upper / Lower locker
	Created_at   time.Time          `json:"created_at"`
	Updated_at   time.Time          `json:"updated_at"`
}

type Photo

type Photo struct {
	ID         primitive.ObjectID `bson:"_id"`
	Name       string             `json:"name" validate:"required"`
	Base64     string             `json:"base64" validate:"required"`
	Created_at time.Time          `json:"created_at"`
	Updated_at time.Time          `json:"updated_at"`
}

type Student

type Student struct {
	ID       primitive.ObjectID `bson:"_id"`
	Personal struct {
		FirstName  string   `json:"firstname" validate:"required"`
		MiddleName string   `json:"middlename"`
		LastName   string   `json:"lastname" validate:"required"`
		Age        float64  `json:"age" validate:"required"`
		Email      string   `json:"email" validate:"required"`
		Address    string   `json:"address"`
		City       string   `json:"city"`
		Province   string   `json:"province"`
		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"`
	School struct {
		GradeLevel float64 `json:"gradelevel" validate:"required"`
		SID        string  `json:"sid"` // Student ID
		PEN        string  `json:"ped"` // Personal Education Number
		Homeroom   string  `json:"homeroom"`
		Locker     string  `json:"-"`         // Locker ID
		YOG        int     `json:"yog"`       // Year of Graduation
		PhotoName  string  `json:"photoname"` // name of photo in db
	} `json:"School"`
	Account struct {
		VerifiedEmail   bool     `json:"verifiedemail"`
		SchoolEmail     string   `json:"schoolemail"`
		Password        string   `json:"-" validate:"min=10,max=32"`
		AccountDisabled bool     `bson:"accountdisabled"`
		Alerted         bool     `bson:"alerted"`
		TempPassword    bool     `json:"temppassword"`
		Attempts        int      `json:"attempts"` // login attempts max 5
		HashHistory     []string `json:"-"`        // List of old hashed passwords (not including auto generated passwords)
	} `json:"Account"`
	Created_at time.Time `json:"created_at"`
	Updated_at time.Time `json:"updated_at"`
}

func (*Student) CheckPasswordStrength

func (s *Student) CheckPasswordStrength(password string) bool

func (*Student) ComparePasswords

func (s *Student) ComparePasswords(password string) bool

func (*Student) EmailExists

func (s *Student) EmailExists(email string) bool

func (*Student) GeneratePassword

func (s *Student) GeneratePassword(passwordLength, minSpecialChar, minNum, minUpperCase int) string

func (*Student) GenerateSchoolEmail

func (s *Student) GenerateSchoolEmail(offset int, lastEmail string) string

func (*Student) HashPassword

func (s *Student) HashPassword(password string) string

func (*Student) UsedPassword

func (s *Student) UsedPassword(password string) bool

type Teacher

type Teacher struct {
	ID       primitive.ObjectID `bson:"_id"`
	Personal struct {
		FirstName  string `json:"firstname" validate:"required"`
		MiddleName string `json:"middlename"`
		LastName   string `json:"lastname" validate:"required"`
		Email      string `json:"email" validate:"required"`
		Address    string `json:"address"`
		City       string `json:"city"`
		Province   string `json:"province"`
		Postal     string `json:"postal"`
		DOB        string `json:"dob" validate:"required"`
	} `json:"personal"`
	School struct {
		TID       string `json:"tid"` // Teacher ID
		Homeroom  string `json:"homeroom"`
		PhotoName string `json:"photoname"` // name of photo in db
	} `json:"School"`
	Account struct {
		VerifiedEmail   bool     `json:"verifiedemail"`
		SchoolEmail     string   `json:"schoolemail"`
		Password        string   `json:"-" validate:"min=10,max=32"`
		AccountDisabled bool     `bson:"accountdisabled"`
		TempPassword    bool     `json:"temppassword"`
		Attempts        int      `json:"attempts"` // login attempts max 5
		HashHistory     []string `json:"-"`        // List of old hashed passwords (not including auto generated passwords)
	} `json:"Account"`
	Created_at time.Time `json:"created_at"`
	Updated_at time.Time `json:"updated_at"`
}

func (*Teacher) CheckPasswordStrength

func (t *Teacher) CheckPasswordStrength(password string) bool

func (*Teacher) ComparePasswords

func (t *Teacher) ComparePasswords(password string) bool

func (*Teacher) EmailExists

func (t *Teacher) EmailExists(email string) bool

func (*Teacher) GeneratePassword

func (t *Teacher) GeneratePassword(passwordLength, minSpecialChar, minNum, minUpperCase int) string

func (*Teacher) GenerateSchoolEmail

func (t *Teacher) GenerateSchoolEmail(offset int, lastEmail string) string

func (*Teacher) HashPassword

func (t *Teacher) HashPassword(password string) string

func (*Teacher) UsedPassword

func (t *Teacher) UsedPassword(password string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL