entities

package
v0.0.0-...-c42784e Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	City   string
	Street string
	House  string
}

type Claims

type Claims struct {
	jwt.RegisteredClaims
	Email      string `json:"email"`
	UserID     int    `json:"user_id"`
	Role       Role   `json:"role"`
	PharmacyID int    `json:"pharmacy_id"`
}

type ContextKey

type ContextKey int
const (
	UserID ContextKey = iota
	Email
	DeviceFingerPrint
	RequestID
	PharmacyID
)

type Pharmacy

type Pharmacy struct {
	ID        int
	Name      string
	IsBlocked bool
	Address   Address
}

type RefreshToken

type RefreshToken struct {
	ID           int
	UserID       int
	Token        string
	UserAgent    string
	IP           string
	FingerPrint  string
	IsAvailable  bool
	CreationTime time.Time
}

type Role

type Role string
const (
	// All use only for access. Don't save in DB this value.
	All        Role = "all"
	Admin      Role = "admin"
	Apothecary Role = "apothecary"
)

type Tokens

type Tokens struct {
	AccessToken  string
	RefreshToken string
}

type User

type User struct {
	ID                int
	Name              string
	Surname           string
	Email             string
	Password          string
	PasswordHash      string
	Role              Role
	UseIPCheck        bool
	IsBlock           bool
	DefaultPharmacyID int
}

type UserIdentifyData

type UserIdentifyData struct {
	IP          string
	UserAgent   string
	FingerPrint string
}

TODO use this for all auth operations.

Jump to

Keyboard shortcuts

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