entities

package
v0.0.0-...-ffefdcf Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SocialCardDiscountMultiplier = 0.95

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	ID     int
	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 PharmacyProductItem

type PharmacyProductItem struct {
	Name           string
	Price          int
	InstructionURL string
	ImgURL         string
	Comment        string
	RecipeOnly     bool
	Position       string
	Count          int
}

type Product

type Product struct {
	ID             int
	Name           string
	Price          string
	ExpirationDate time.Duration
	InstructionURL string
	ImgURL         string
	Comment        string
	RecipeOnly     bool
}

type ProductItem

type ProductItem struct {
	ID               int
	ProductID        int
	PharmacyID       int
	ReceiptID        int
	Position         string
	ManufacturedTime string
	ReservationUUID  string
	IsSold           bool
	IsExpired        bool
	Priority         int
}

type Purchase

type Purchase struct {
	Price    int
	Products []PurchaseProductItem
}

type PurchaseProductItem

type PurchaseProductItem struct {
	Name  string
	Count int
	Price int
}

type Receipt

type Receipt struct {
	ID         int
	UserID     int
	PharmacyID int
	Sum        float64
	Discount   int
}

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
	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