common

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package common contains shared domain models used across the application.

Package common contains shared domain models used across the application.

Package common contains shared domain models used across the application.

Package common contains shared domain models used across the application.

Package common contains shared domain models used across the application.

Package common contains shared domain models used across the application.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCollectionNotFound indicates a requested collection was not found.
	ErrCollectionNotFound = errors.New("collection not found")
	// ErrUserNotFound indicates an authenticated user was not found in context or storage.
	ErrUserNotFound = errors.New("user not found")
	// ErrExpiredToken indicates the provided JWT has already expired.
	ErrExpiredToken = errors.New("token already expired")
	// ErrInvalidToken indicates the provided JWT is malformed or invalid.
	ErrInvalidToken = errors.New("token invalid")
	// ErrQRRecordNotExist indicates a QR record does not exist.
	ErrQRRecordNotExist = errors.New("qr record not exist")
	// ErrJwtIncorrect indicates an incorrect or missing JWT in request headers.
	ErrJwtIncorrect = errors.New("invalid jwt")
	// ErrDeviceNotFound indicates a device was not found for the given identifier.
	ErrDeviceNotFound = errors.New("device not found")
	// ErrUnauthorized indicates no valid authentication was provided.
	ErrUnauthorized = errors.New("unauthenticated")
	// ErrNotAdmin indicates the authenticated principal lacks admin privileges.
	ErrNotAdmin = errors.New("forbidden: admin required")
)
View Source
var BeverageTypeStringMap = map[BeverageType]string{
	TeaBeverageType:    "tea",
	HerbBeverageType:   "herb",
	CoffeeBeverageType: "coffee",
	OtherBeverageType:  "other",
}

BeverageTypeStringMap maps BeverageType values to their string representations.

Functions

This section is empty.

Types

type BeverageType

type BeverageType int

BeverageType categorizes beverages like tea, herb, coffee, or other.

const (
	// TeaBeverageType represents traditional tea beverages.
	TeaBeverageType BeverageType = iota
	// HerbBeverageType represents herbal infusions/additives.
	HerbBeverageType
	// CoffeeBeverageType represents coffee beverages.
	CoffeeBeverageType
	// OtherBeverageType represents any other beverage type.
	OtherBeverageType
)

BeverageType enumerations define available beverage categories.

func StringToBeverageType

func StringToBeverageType(str string) BeverageType

StringToBeverageType converts a string label to a BeverageType, defaulting to OtherBeverageType.

func (BeverageType) String

func (b BeverageType) String() string

type Collection

type Collection struct {
	ID   uuid.UUID
	Name string
}

Collection represents a user-defined grouping of QR tea records.

type CollectionRecord

type CollectionRecord struct {
	ID             uuid.UUID
	Tea            *Tea
	BowlingTemp    int
	ExpirationDate time.Time
}

CollectionRecord represents a QR-coded tea item tracked in a Collection.

type Device

type Device struct {
	UserID uuid.UUID
	Token  string
}

Device represents a user device eligible to receive push notifications.

type Notification

type Notification struct {
	UserID uuid.UUID
	Type   NotificationType
}

Notification describes a notification event for a user.

type NotificationType

type NotificationType int

NotificationType is the domain-level enum of notification categories.

const (
	// NotificationTypeTeaExpiration notifies about upcoming tea expiration.
	NotificationTypeTeaExpiration NotificationType = iota
	// NotificationTypeTeaRecommendation suggests a tea to drink.
	NotificationTypeTeaRecommendation
)

NotificationType enumerates the kinds of notifications that can be sent to users.

type QR

type QR struct {
	Tea            uuid.UUID
	BowlingTemp    int
	ExpirationDate time.Time
}

QR describes QR-stored metadata that refers to a particular tea instance.

type Rain

type Rain float64

Rain represents precipitation intensity in mm/h.

func (Rain) String

func (r Rain) String() string

type Session

type Session struct {
	JWT       string
	User      *User
	ExpiredAt time.Time
}

Session contains JWT and expiration metadata for a user session.

type Tag

type Tag struct {
	ID uuid.UUID
	*TagData
}

Tag describes a label that can be attached to a tea (e.g., "bergamot", "green").

type TagCategory

type TagCategory struct {
	ID   uuid.UUID
	Name string
}

TagCategory represents a category to which tags belong (e.g., flavor, origin).

type TagData

type TagData struct {
	Name       string
	Color      string
	CategoryID uuid.UUID
}

TagData holds mutable tag fields.

type Tea

type Tea struct {
	ID uuid.UUID
	*TeaData
}

Tea represents a beverage entity with its metadata.

type TeaData

type TeaData struct {
	Name        string       `json:"name"`
	Type        BeverageType `json:"type"`
	Description string       `json:"description"`
}

TeaData holds descriptive fields for a tea beverage.

type User

type User struct {
	ID      uuid.UUID
	AppleID string
	Session
}

User represents an authenticated TeaElephant user.

type Weather

type Weather struct {
	Temperature float64
	Clouds      int
	Rain        Rain
	Humidity    int
	WindSpeed   float64
	Visibility  int
}

Weather captures environmental conditions relevant to recommendations.

func (Weather) String

func (w Weather) String() string

Directories

Path Synopsis
key_value

Jump to

Keyboard shortcuts

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