Documentation ¶
Index ¶
- Constants
- Variables
- func ClockinCreate(student_id string) error
- func ClockinDeleteByID(clockinID string) error
- func NoteCreate(content string, userID string) error
- func NoteDelete(userID string, noteID string) error
- func NoteUpdate(content string, userID string, noteID string) error
- func StudentCreate(first_name, last_name, grade, escaped_student_id string, balance float64, ...) error
- func StudentDelete(studentID string) error
- func StudentUpdate(studentID, firstName, lastName, grade string) error
- func UserCreate(first_name, last_name, email, password string) error
- type Clockin
- type Note
- type Student
- type User
Constants ¶
View Source
const ( Beforecare = 5 * iota Aftercare Both )
Variables ¶
View Source
var ( // ErrCode is a config or an internal error ErrCode = errors.New("Case statement in code is not correct.") // ErrNoResult is a not results error ErrNoResult = errors.New("Result not found.") //ErrNoSuchStudent is there is no such student ErrNoSuchStudent = errors.New("Try a valid student ID please.") ErrUnavailable = errors.New("Database is unavailable.") ErrUnauthorized = errors.New("User does not have permission to perform this operation.") )
Functions ¶
func ClockinDeleteByID ¶
ClockinDelete deletes a note Also add an admin checking for delete functionality
func NoteUpdate ¶
NoteUpdate updates a note
func StudentCreate ¶
func StudentCreate(first_name, last_name, grade, escaped_student_id string, balance float64, caretype int64, fivedays, freereduced bool) error
StudentCreate creates student
func StudentUpdate ¶
StudentUpdate updates a student
func UserCreate ¶
UserCreate creates user
Types ¶
type Clockin ¶
type Clockin struct { ObjectID bson.ObjectId `bson:"_id"` StudentID string `bson:"student_id"` InAt int64 `db:"in_at" bson:"in_at"` OutAt int64 `db:"out_at" bson:"out_at"` TotalTime int64 `db:"total_time" bson:"total_time"` IsOut bool `db:"is_out" bson:"is_out"` }
Note table contains the information for each note
func ClockinsByStudentID ¶
ClockinsByStudentID gets all clockins for a student
func LastClockinByStudentID ¶
LastClockinByStudentID gets the last clockin for a student
type Note ¶
type Note struct { ObjectID bson.ObjectId `bson:"_id"` ID uint32 `db:"id" bson:"id,omitempty"` // Don't use Id, use NoteID() instead for consistency with MongoDB Content string `db:"content" bson:"content"` UserID bson.ObjectId `bson:"user_id"` UID uint32 `db:"user_id" bson:"userid,omitempty"` CreatedAt time.Time `db:"created_at" bson:"created_at"` UpdatedAt time.Time `db:"updated_at" bson:"updated_at"` Deleted uint8 `db:"deleted" bson:"deleted"` }
Note table contains the information for each note
func NotesByUserID ¶
NotesByUserID gets all notes for a user
type Student ¶
type Student struct { ObjectId bson.ObjectId `bson:"_id"` First_name string `db:"first_name" bson:"first_name"` Last_name string `db:"last_name" bson:"last_name"` Grade string `db:"grade" bson:"grade"` Student_id string `db:"student_id" bson:"student_id"` Created_at time.Time `db:"created_at" bson:"created_at"` Updated_at time.Time `db:"updated_at" bson:"updated_at"` Deleted uint8 `db:"deleted" bson:"deleted"` FiveDays bool `db:"fivedays" bson:"fivedays"` CareType int64 `db:"caretype" bson:"caretype"` FreeReduced bool `db:"freereduced" bson:"freereduced"` Balance float64 `db:"balance" bson:"balance"` }
Student table contains the information for each student
func StudentBySID ¶
StudentBySID gets student information from student school id
type User ¶
type User struct { ObjectId bson.ObjectId `bson:"_id"` First_name string `db:"first_name" bson:"first_name"` Last_name string `db:"last_name" bson:"last_name"` Email string `db:"email" bson:"email"` Password string `db:"password" bson:"password"` Status_id uint8 `db:"status_id" bson:"status_id"` Created_at time.Time `db:"created_at" bson:"created_at"` Updated_at time.Time `db:"updated_at" bson:"updated_at"` Deleted uint8 `db:"deleted" bson:"deleted"` }
User table contains the information for each user
func UserByEmail ¶
UserByEmail gets user information from email
Click to show internal directories.
Click to hide internal directories.