models

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrashTypeCardboard = "cardboard"
	TrashTypeGlass     = "glass"
	TrashTypeMetal     = "metal"
	TrashTypePaper     = "paper"
	TrashTypePlastic   = "plastic"
	TrashTypeTrash     = "trash"
	TrashTypeUndefined = "undefined"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Achievement

type Achievement struct {
}

type File

type File struct {
	ID    uuid.UUID
	Name  string
	Size  int64
	Entry io.ReadCloser
}

type LoginHistory

type LoginHistory db.LoginHistory

type Prediction

type Prediction struct {
	ID        uuid.UUID        `json:"id"`
	UserID    uuid.UUID        `json:"user_id"`
	TrashScan string           `json:"scan_key"`
	Status    PredictionStatus `json:"status"`
	Result    PredictionResult `json:"result"`
	Error     string           `json:"error"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func NewPredictionsList

func NewPredictionsList(predictions []db.Prediction) []*Prediction

func (Prediction) IsValid

func (pr Prediction) IsValid() bool

func (*Prediction) Model

func (pr *Prediction) Model(prediction db.Prediction)

type PredictionResult

type PredictionResult map[string]float64

func NewPredictionResult

func NewPredictionResult(m map[uint8]float64) PredictionResult

type PredictionStatus

type PredictionStatus string
const (
	PredictionProcessingStatus PredictionStatus = "processing"
	PredictionCompletedStatus  PredictionStatus = "completed"
	PredictionFailedStatus     PredictionStatus = "failed"
)

func (PredictionStatus) IsValid

func (st PredictionStatus) IsValid() bool

func (PredictionStatus) String

func (st PredictionStatus) String() string

type RefreshToken

type RefreshToken db.RefreshToken

func NewRefreshFromClaims

func NewRefreshFromClaims(hash string, claims jwt.RegisteredClaims) *RefreshToken

type Stat

type Stat struct {
	ID            uuid.UUID      `json:"id"`
	Status        UserStatus     `json:"status"`
	Rating        int            `json:"rating"`
	FilesScanned  int            `json:"files_scanned"`
	TotalWeight   float64        `json:"total_weight"`
	LastScannedAt time.Time      `json:"last_scanned_at,omitempty"`
	Achievements  []Achievement  `json:"-"`
	TrashByTypes  map[string]int `json:"trash_by_types"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
}

func (*Stat) Model

func (s *Stat) Model(stat db.Stat)

type TrashType

type TrashType uint8
const (
	Cardboard TrashType = iota
	Glass
	Metal
	Paper
	Plastic
	Trash
	Undefined
)

func NewTrashType

func NewTrashType(val string) TrashType

func (TrashType) String

func (tr TrashType) String() string

func (TrashType) StringPtr

func (tr TrashType) StringPtr() *string

type User

type User struct {
	ID             uuid.UUID `json:"id"`
	Login          string    `json:"login"`
	Name           string    `json:"name"`
	HashedPassword string    `json:"-"`
	Avatar         *string   `json:"avatar,omitempty"`
	Stat           *Stat     `json:"stat,omitempty"`
	Deleted        bool      `json:"-"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

func (*User) Model

func (u *User) Model(user db.User)

func (*User) WithStat

func (u *User) WithStat(stat db.Stat)

type UserStatus

type UserStatus string
const (
	UserStatusNewbie      UserStatus = "newbie"          // Новичок 0
	UserStatusEcoScout    UserStatus = "eco_scout"       // Эко-разведчик 100+
	UserStatusGreenGuard  UserStatus = "green_guard"     // Зеленый страж 300+
	UserStatusEcoWarrior  UserStatus = "eco_warrior"     // Эко-воин 500+
	UserStatusNatureHero  UserStatus = "nature_hero"     // Герой природы 1000+
	UserStatusEarthDefend UserStatus = "earth_defender"  // Защитник Земли 1500+
	UserStatusEcoChampion UserStatus = "eco_champion"    // Эко-чемпион 3000+
	UserStatusPlanetGuard UserStatus = "planet_guardian" // Хранитель планеты 5000+
	UserStatusEcoLegend   UserStatus = "eco_legend"      // Эко-легенда 10000+
)

func (UserStatus) Valid

func (s UserStatus) Valid() bool

Jump to

Keyboard shortcuts

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