user

package
v0.0.0-...-c435964 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	AuthToken *AuthToken `json:"authToken"`
	User      *User      `json:"user"`
}

AuthResponse model

type AuthToken

type AuthToken struct {
	AccessToken string    `json:"accessToken"`
	ExpiredAt   time.Time `json:"expiredAt"`
}

AuthToken model

type Repo

type Repo struct {
	DB *pg.DB
}

Repo contains all User related functions

func (*Repo) GetUserByID

func (ur *Repo) GetUserByID(ID string) (*User, error)

GetUserByID gets user by id

func (*Repo) LoginUser

func (ur *Repo) LoginUser(input model.LoginInput) (*AuthResponse, error)

LoginUser logs in a user

func (*Repo) RegisterUser

func (ur *Repo) RegisterUser(input model.RegisterInput) (*AuthResponse, error)

RegisterUser registers users

type User

type User struct {
	ID        string    `json:"id" pg:"type:uuid,unique,default:gen_random_uuid()"`
	Email     string    `json:"email" pg:",unique,notnull"`
	Password  string    `json:"password" pg:",notnull"`
	FirstName string    `json:"firstName" pg:",notnull"`
	LastName  *string   `json:"lastName"`
	CreatedAt time.Time `json:"createdAt" pg:"type:timestamp,notnull"`
}

User model

Jump to

Keyboard shortcuts

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