storage

package
v0.0.0-...-ae75a06 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 32

Documentation

Index

Constants

View Source
const (
	SeedActivityCode            = "SEED"
	MoveActivityCode            = "MOVE"
	HarvestActivityCode         = "HARVEST"
	DumpActivityCode            = "DUMP"
	PhotoActivityCode           = "PHOTO"
	WaterActivityCode           = "WATER"
	TaskCropActivityCode        = "TASK_CROP"
	TaskNutrientActivityCode    = "TASK_NUTRIENT"
	TaskPestControlActivityCode = "TASK_PEST_CONTROL"
	TaskSafetyActivityCode      = "TASK_SAFETY"
	TaskSanitationActivityCode  = "TASK_SANITATION"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityType

type ActivityType interface {
	Code() string
}

type AreaStatus

type AreaStatus struct {
	Seeding int `json:"seeding"`
	Growing int `json:"growing"`
	Dumped  int `json:"dumped"`
}

type Container

type Container struct {
	Type     string `json:"type"`
	Quantity int    `json:"quantity"`
	Cell     int    `json:"cell"`
}

type CropActivity

type CropActivity struct {
	UID           uuid.UUID    `json:"uid"`
	BatchID       string       `json:"batch_id"`
	ContainerType string       `json:"container_type"`
	ActivityType  ActivityType `json:"activity_type"`
	CreatedDate   time.Time    `json:"created_date"`
	Description   string       `json:"description"`
}

type CropActivityStorage

type CropActivityStorage struct {
	Lock            *deadlock.RWMutex
	CropActivityMap []CropActivity
}

func CreateCropActivityStorage

func CreateCropActivityStorage() *CropActivityStorage

type CropEvent

type CropEvent struct {
	CropUID     uuid.UUID
	Version     int
	CreatedDate time.Time
	Event       interface{}
}

type CropEventStorage

type CropEventStorage struct {
	Lock       *deadlock.RWMutex
	CropEvents []CropEvent
}

func CreateCropEventStorage

func CreateCropEventStorage() *CropEventStorage

type CropPhoto

type CropPhoto struct {
	UID         uuid.UUID `json:"uid"`
	Filename    string    `json:"filename"`
	MimeType    string    `json:"mime_type"`
	Size        int       `json:"size"`
	Width       int       `json:"width"`
	Height      int       `json:"height"`
	Description string    `json:"description"`
}

type CropRead

type CropRead struct {
	UID        uuid.UUID   `json:"uid"`
	BatchID    string      `json:"batch_id"`
	Status     string      `json:"status"`
	Type       string      `json:"type"`
	Container  Container   `json:"container"`
	Inventory  Inventory   `json:"inventory"`
	AreaStatus AreaStatus  `json:"area_status"`
	Photos     []CropPhoto `json:"photos"`
	FarmUID    uuid.UUID   `json:"farm_id"`

	// Fields to track crop's movement
	InitialArea      InitialArea        `json:"initial_area"`
	MovedArea        []MovedArea        `json:"moved_area"`
	HarvestedStorage []HarvestedStorage `json:"harvested_storage"`
	Trash            []Trash            `json:"trash"`

	// Notes
	Notes []domain.CropNote `json:"notes"`
}

type CropReadStorage

type CropReadStorage struct {
	Lock        *deadlock.RWMutex
	CropReadMap map[uuid.UUID]CropRead
}

func CreateCropReadStorage

func CreateCropReadStorage() *CropReadStorage

type DumpActivity

type DumpActivity struct {
	SrcAreaUID  uuid.UUID `json:"source_area_id"`
	SrcAreaName string    `json:"source_area_name"`
	Quantity    int       `json:"quantity"`
	DumpDate    time.Time `json:"dump_date"`
}

func (DumpActivity) Code

func (a DumpActivity) Code() string

type HarvestActivity

type HarvestActivity struct {
	Type                 string    `json:"type"`
	SrcAreaUID           uuid.UUID `json:"source_area_id"`
	SrcAreaName          string    `json:"source_area_name"`
	Quantity             int       `json:"quantity"`
	ProducedGramQuantity float32   `json:"produced_gram_quantity"`
	HarvestDate          time.Time `json:"harvest_date"`
}

func (HarvestActivity) Code

func (a HarvestActivity) Code() string

type HarvestedStorage

type HarvestedStorage struct {
	Quantity             int       `json:"quantity"`
	ProducedGramQuantity float32   `json:"produced_gram_quantity"`
	SourceAreaUID        uuid.UUID `json:"source_area_id"`
	SourceAreaName       string    `json:"source_area_name"`
	CreatedDate          time.Time `json:"created_date"`
	LastUpdated          time.Time `json:"last_updated"`
}

type InitialArea

type InitialArea struct {
	AreaUID         uuid.UUID  `json:"area_id"`
	Name            string     `json:"name"`
	InitialQuantity int        `json:"initial_quantity"`
	CurrentQuantity int        `json:"current_quantity"`
	LastWatered     *time.Time `json:"last_watered"`
	LastFertilized  *time.Time `json:"last_fertilized"`
	LastPruned      *time.Time `json:"last_pruned"`
	LastPesticided  *time.Time `json:"last_pesticided"`
	CreatedDate     time.Time  `json:"created_date"`
	LastUpdated     time.Time  `json:"last_updated"`
}

type Inventory

type Inventory struct {
	UID       uuid.UUID `json:"uid"`
	Type      string    `json:"type"`
	PlantType string    `json:"plant_type"`
	Name      string    `json:"name"`
}

type MoveActivity

type MoveActivity struct {
	SrcAreaUID  uuid.UUID `json:"source_area_id"`
	SrcAreaName string    `json:"source_area_name"`
	DstAreaUID  uuid.UUID `json:"destination_area_id"`
	DstAreaName string    `json:"destination_area_name"`
	Quantity    int       `json:"quantity"`
	MovedDate   time.Time `json:"moved_date"`
}

func (MoveActivity) Code

func (a MoveActivity) Code() string

type MovedArea

type MovedArea struct {
	AreaUID         uuid.UUID  `json:"area_id"`
	Name            string     `json:"name"`
	InitialQuantity int        `json:"initial_quantity"`
	CurrentQuantity int        `json:"current_quantity"`
	LastWatered     *time.Time `json:"last_watered"`
	LastFertilized  *time.Time `json:"last_fertilized"`
	LastPruned      *time.Time `json:"last_pruned"`
	LastPesticided  *time.Time `json:"last_pesticided"`
	CreatedDate     time.Time  `json:"created_date"`
	LastUpdated     time.Time  `json:"last_updated"`
}

type PhotoActivity

type PhotoActivity struct {
	UID         uuid.UUID `json:"uid"`
	Filename    string    `json:"filename"`
	MimeType    string    `json:"mime_type"`
	Size        int       `json:"size"`
	Width       int       `json:"width"`
	Height      int       `json:"height"`
	Description string    `json:"description"`
}

func (PhotoActivity) Code

func (a PhotoActivity) Code() string

type SeedActivity

type SeedActivity struct {
	AreaUID     uuid.UUID `json:"area_id"`
	AreaName    string    `json:"area_name"`
	Quantity    int       `json:"quantity"`
	SeedingDate time.Time `json:"seeding_date"`
}

func (SeedActivity) Code

func (a SeedActivity) Code() string

type TaskCropActivity

type TaskCropActivity struct {
	TaskUID     uuid.UUID `json:"task_id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	AreaName    string    `json:"area_name"`
}

func (TaskCropActivity) Code

func (a TaskCropActivity) Code() string

type TaskNutrientActivity

type TaskNutrientActivity struct {
	TaskUID      uuid.UUID `json:"task_id"`
	MaterialType string    `json:"material_type"`
	MaterialName string    `json:"material_name"`
	AreaName     string    `json:"area_name"`
}

func (TaskNutrientActivity) Code

func (a TaskNutrientActivity) Code() string

type TaskPestControlActivity

type TaskPestControlActivity struct {
	TaskUID      uuid.UUID `json:"task_id"`
	MaterialType string    `json:"material_type"`
	MaterialName string    `json:"material_name"`
	AreaName     string    `json:"area_name"`
}

func (TaskPestControlActivity) Code

type TaskSafetyActivity

type TaskSafetyActivity struct {
	TaskUID     uuid.UUID `json:"task_id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	AreaName    string    `json:"area_name"`
}

func (TaskSafetyActivity) Code

func (a TaskSafetyActivity) Code() string

type TaskSanitationActivity

type TaskSanitationActivity struct {
	TaskUID     uuid.UUID `json:"task_id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	AreaName    string    `json:"area_name"`
}

func (TaskSanitationActivity) Code

func (a TaskSanitationActivity) Code() string

type Trash

type Trash struct {
	Quantity       int       `json:"quantity"`
	SourceAreaUID  uuid.UUID `json:"source_area_id"`
	SourceAreaName string    `json:"source_area_name"`
	CreatedDate    time.Time `json:"created_date"`
	LastUpdated    time.Time `json:"last_updated"`
}

type WaterActivity

type WaterActivity struct {
	AreaUID      uuid.UUID `json:"area_id"`
	AreaName     string    `json:"area_name"`
	WateringDate time.Time `json:"watering_date"`
}

func (WaterActivity) Code

func (a WaterActivity) Code() string

Jump to

Keyboard shortcuts

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