domain

package
v0.0.0-...-7ca28c2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskTypeRandom = "random"
	TaskTypePrice  = "price"
)

task types

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID         int
	Hash       string
	Source     string
	Task       string // task code (from external system)
	Data       ItemData
	CreateTime time.Time
}

Item in an piece of data collected by a task during one run

type ItemData

type ItemData struct {
	// fot task type random
	Value int `json:"value"`
	// for task type price
	Price    float64 `json:"price,omitempty"`
	PriceMax float64 `json:"priceMax,omitempty"`
	PriceMin float64 `json:"priceMin,omitempty"`
	Product  string  `json:"product,omitempty"`
	Seller   string  `json:"seller,omitempty"`
	// for task type word
	Word string  `json:"word,omitempty"`
	Rate float64 `json:"rate,omitempty"`
	// common
	Platform string `json:"platform,omitempty"`
}

ItemData holds item payload

type SystemSymmary

type SystemSymmary struct {
	ID              int
	Users           int
	Tasks           int
	ActiveTasks     int
	Items           int
	AvgItemsPerTask float64
	CreateTime      time.Time
}

SystemSymmary holds system state gathered by the relevant job

type Task

type Task struct {
	ID          int    // id is passed to domain model for simplicity
	Code        string // unique task code for external systems
	User        string // username
	Type        string // task type code
	Slug        string
	Title       string
	Description string
	Active      bool
	Items       []Item
	Meta        TaskMeta
	Params      TaskParams
}

Task represents data backend task

type TaskMeta

type TaskMeta struct{}

TaskMeta from something

type TaskParams

type TaskParams struct {
	Random TaskParamsRandom `json:"random,omitempty"`
	Price  TaskParamsPrice  `json:"price,omitempty"`
}

TaskParams holds task running params provided by user

type TaskParamsPrice

type TaskParamsPrice struct{}

TaskParamsPrice hold params from 'price' task

type TaskParamsRandom

type TaskParamsRandom struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

TaskParamsRandom hold params from 'random' task

type TaskType

type TaskType struct {
	ID   int
	Code string
}

TaskType holds task types e.g. 'price', 'random'

type User

type User struct {
	ID           int  // id is passed to domain model for simplicity
	Service      bool // if user is a service // TODO: only service users create items
	Username     string
	Password     string
	PasswordHash string
	Email        string // TODO: add ent validation
}

User holds user data

Jump to

Keyboard shortcuts

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