accounts

package
v0.0.0-...-9fcd9d5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accounts

type Accounts struct {
	// contains filtered or unexported fields
}

func NewAccounts

func NewAccounts(sessionManager sessionmanager.SessionManager, db UsersDB) Accounts

func (*Accounts) DeleteAcc

func (a *Accounts) DeleteAcc(c *gin.Context)

This handler was made so users can request to delete their data from our database. This data will be permanently deleted, 15 days after request.

func (*Accounts) Login

func (a *Accounts) Login(c *gin.Context)

A dead simple Login api, which returns an error message or a session token, which is set by the session manager.

func (*Accounts) Logout

func (a *Accounts) Logout(c *gin.Context)

This handle calls the DeleteSession key function, and if there is no error, it returns a succes message.

func (*Accounts) Register

func (a *Accounts) Register(c *gin.Context)

This function registers a new document in the database with the new users data. It can return multiple types of error messages or at succesful registration session token.

type AccountsTestSetup

type AccountsTestSetup struct {
	// contains filtered or unexported fields
}

func InitAccountsTestSetup

func InitAccountsTestSetup(t *testing.T) *AccountsTestSetup

type UserRepo

type UserRepo struct {
	// contains filtered or unexported fields
}

func NewUserRepo

func NewUserRepo(db *mgo.Collection) UserRepo

func (UserRepo) FindByEmail

func (u UserRepo) FindByEmail(email string, user *model.User) bool

func (UserRepo) FindByUserName

func (u UserRepo) FindByUserName(userName string, user *model.User) bool

func (UserRepo) Insert

func (u UserRepo) Insert(user *model.User) error

func (UserRepo) RemoveAll

func (u UserRepo) RemoveAll(duration time.Duration) error

func (UserRepo) Update

func (u UserRepo) Update(userName string, t time.Time) error

type UsersDB

type UsersDB interface {
	FindByEmail(email string, user *model.User) bool
	FindByUserName(userName string, user *model.User) bool
	Update(userName string, t time.Time) error
	Insert(user *model.User) error
	RemoveAll(duration time.Duration) error
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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