models

package
v0.0.0-...-87a3a10 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blacklist

type Blacklist struct {
	ID    bson.ObjectId `json:"_id,omitempty" bson:"_id,omitempty"`
	Token string        `json:"token" bson:"token"`
}

Blacklist defines token blacklist structure

type BlacklistModel

type BlacklistModel struct{}

BlacklistModel defines balclist model

func (*BlacklistModel) Add

func (b *BlacklistModel) Add(token string) (err error)

Add handle adding token to blacklist

func (*BlacklistModel) FindToken

func (b *BlacklistModel) FindToken(token string) (doc Blacklist, err error)

FindToken handle getting a single user

type User

type User struct {
	ID         bson.ObjectId       `json:"_id,omitempty" bson:"_id,omitempty"`
	Name       string              `json:"name" bson:"name"`
	Email      string              `json:"email" bson:"email"`
	Password   string              `json:"password" bson:"password"`
	Role       string              `json:"role" bson:"role"`
	IsVerified bool                `json:"is_verified" bson:"is_verified"`
	CreatedAt  bson.MongoTimestamp `json:"created_at" bson:"created_at"`
	UpdatedAt  bson.MongoTimestamp `json:"updated_at" bson:"updated_at"`
}

User defines user structure

type UserModel

type UserModel struct{}

UserModel defines the model structure

func (*UserModel) Find

func (u *UserModel) Find() (list []User, err error)

Find handles fetching all users

func (*UserModel) GetUserByEmail

func (u *UserModel) GetUserByEmail(email string) (user User, err error)

GetUserByEmail handle getting a single user

func (*UserModel) GetUserByEmailCount

func (u *UserModel) GetUserByEmailCount(email string) (user User, err error)

GetUserByEmailCount handle getting a single user

func (*UserModel) GetUserByUserID

func (u *UserModel) GetUserByUserID(userID string) (user User, err error)

GetUserByUserID handle getting a user by userid

func (*UserModel) Login

func (u *UserModel) Login(email string) (user User, err error)

Login handles finding user by email and account verified

func (*UserModel) PasswordUpdate

func (u *UserModel) PasswordUpdate(email string, hashedPassword string) (user User, err error)

PasswordUpdate handle updating user password

func (*UserModel) Signup

func (u *UserModel) Signup(data forms.SignupUserCommand) error

Signup handle registering a user

func (*UserModel) VerifyAccount

func (u *UserModel) VerifyAccount(email string) (user User, err error)

VerifyAccount handle verifying a user account

Jump to

Keyboard shortcuts

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