users

package
v0.0.0-...-6cc2e2a Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request, collection *mongo.Collection)

func GetUser

func GetUser(w http.ResponseWriter, r *http.Request, collection *mongo.Collection)

GetUser retrieves a user by username

func GetUsers

func GetUsers(w http.ResponseWriter, r *http.Request, collection *mongo.Collection)

GetUsers retrieves all users from the MongoDB collection

func Logout

func Logout(w http.ResponseWriter, r *http.Request, collection *mongo.Collection)

Empty function to match partern company specs. Client will need to delete JWT.

func SignIn

func SignIn(w http.ResponseWriter, r *http.Request, collection *mongo.Collection)

SignIn: Does Sign In process, and returns jwt token and user role

func UpdateUser

func UpdateUser(w http.ResponseWriter, r *http.Request, collection *mongo.Collection)

UpdateUser handles updating an existing user

Types

type User

type User struct {
	Username      string                `json:"username" bson:"username"`
	Email         string                `json:"email" bson:"email"`
	Password      string                `json:"password" bson:"password"`
	Name          string                `json:"name" bson:"name"`
	IsAdmin       bool                  `json:"-" bson:"isAdmin"`
	Peng          bool                  `json:"peng" bson:"peng"`
	Pref_approved bool                  `json:"pref_approved" bson:"pref_approved"`
	Max_courses   int                   `json:"max_courses" bson:"max_courses"`
	Course_pref   []string              `json:"course_pref" bson:"course_pref"`
	Time_pref     map[string][][]string `json:"time_pref" bson:"time_pref"`
	Available     map[string][][]string `json:"available" bson:"available"`
}

User represents a user entity

Jump to

Keyboard shortcuts

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