models

package
v0.0.0-...-c4b14b8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessCookieName  = "access-cookie"
	RefreshCookieName = "refresh-cookie"
)

Variables

View Source
var (
	ErrNotFound             = errors.New("not found")
	ErrInvalidSigningMethod = errors.New("invalid signing method")
	ErrWrongTokenClaimType  = errors.New("wrong token claim type")
	ErrUniqueViolation      = errors.New("this user is already exist")
	ErrWrongCredentials     = errors.New("invalid login or password")
	ErrNoSession            = errors.New("there is no such session")
	ErrEmptyCookie          = errors.New("empty cookie")
)

Functions

This section is empty.

Types

type Claims

type Claims struct {
	jwt.StandardClaims
	UserID primitive.ObjectID
}

type LoginInput

type LoginInput struct {
	Email    string `json:"email" validate:"required,email" example:"admin@example.com"`
	Password string `json:"password" validate:"required" example:"password12345"`
}

type Response

type Response struct {
	Message string `json:"message" example:"response message"`
}

type Responser

type Responser struct {
	Log *slog.Logger
}

func (*Responser) Debug

func (r *Responser) Debug(msg string, status int, err error) *fiber.Error

func (*Responser) Error

func (r *Responser) Error(msg string, status int, err error) *fiber.Error

func (*Responser) Info

func (r *Responser) Info(msg string, status int, err error) *fiber.Error

func (*Responser) Warn

func (r *Responser) Warn(msg string, status int, err error) *fiber.Error

type TokenPair

type TokenPair struct {
	AccessToken   string `json:"access_token"`
	AccessExpire  time.Time
	RefreshToken  string `json:"refresh_token"`
	RefresgExpire time.Time
}

type User

type User struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id" validate:"omitempty" example:""`
	Email     string             `bson:"email" json:"email" validate:"email" example:"admin@example.com"`
	Password  string             `bson:"password" json:"password" validate:"min=8" example:"password12345"`
	FirstName string             `bson:"first_name" json:"first_name" validate:"omitempty" example:"Alex"`
	LastName  string             `bson:"last_name" json:"last_name" validate:"omitempty" example:"Johnson"`
}

Jump to

Keyboard shortcuts

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