entities

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Version   string
	GoVersion string
	BuildTime time.Time
	Git       Git
	Server    Server
	Map       Map
}

type AuthPlugin added in v1.1.0

type AuthPlugin struct {
	ClientID     string
	ClientSecret string
}

type BasicEvent added in v1.1.0

type BasicEvent struct {
	// contains filtered or unexported fields
}

func (BasicEvent) Type added in v1.1.0

func (e BasicEvent) Type() EventType

type ClientToken

type ClientToken struct {
	AccessToken      string
	IDToken          string
	Expiry           time.Time
	ExpiresIn        int
	RefreshExpiresIn int
	RefreshToken     string
	TokenType        string
	NotBeforePolicy  int
	SessionState     string
	Scope            string
}

type DrivingLicense added in v1.1.0

type DrivingLicense string
const (
	DrivingLicenseB  DrivingLicense = "B"
	DrivingLicenseBE DrivingLicense = "BE"
	DrivingLicenseC  DrivingLicense = "C"
	DrivingLicenseCE DrivingLicense = "CE"
)

func ParseDrivingLicense added in v1.2.0

func ParseDrivingLicense(drivingLicense string) DrivingLicense

type Entities

type Entities interface {
	Sensor |
		Vehicle |
		TreeCluster |
		Tree |
		Region |
		WateringPlan |
		Evaluation
}

type EntityFunc

type EntityFunc[T Entities] func(*T)

type Evaluation added in v1.2.0

type Evaluation struct {
	TreeCount             int64
	TreeClusterCount      int64
	SensorCount           int64
	WateringPlanCount     int64
	TotalWaterConsumption int64
	UserWateringPlanCount int64
	VehicleEvaluation     []*VehicleEvaluation
	RegionEvaluation      []*RegionEvaluation
}

type EvaluationValue added in v1.1.0

type EvaluationValue struct {
	WateringPlanID int32
	TreeClusterID  int32
	ConsumedWater  *float64
}

type Event added in v1.1.0

type Event interface {
	Type() EventType
}

type EventCreateTree added in v1.1.0

type EventCreateTree struct {
	BasicEvent
	New          *Tree
	PrevOfSensor *Tree
}

func NewEventCreateTree added in v1.1.0

func NewEventCreateTree(newTree, prevOfSensor *Tree) EventCreateTree

type EventDeleteTree added in v1.1.0

type EventDeleteTree struct {
	BasicEvent
	Prev *Tree
}

func NewEventDeleteTree added in v1.1.0

func NewEventDeleteTree(prev *Tree) EventDeleteTree

type EventNewSensorData added in v1.1.0

type EventNewSensorData struct {
	BasicEvent
	New *SensorData
}

func NewEventSensorData added in v1.1.0

func NewEventSensorData(newData *SensorData) EventNewSensorData

type EventType added in v1.1.0

type EventType string
const (
	EventTypeUpdateTree         EventType = "update tree"
	EventTypeCreateTree         EventType = "create tree"
	EventTypeDeleteTree         EventType = "delete tree"
	EventTypeUpdateTreeCluster  EventType = "update tree cluster"
	EventTypeNewSensorData      EventType = "receive sensor data"
	EventTypeUpdateWateringPlan EventType = "update watering plan"
)

type EventUpdateTree added in v1.1.0

type EventUpdateTree struct {
	BasicEvent
	Prev         *Tree
	New          *Tree
	PrevOfSensor *Tree
}

func NewEventUpdateTree added in v1.1.0

func NewEventUpdateTree(prev, newTree, prevOfSensor *Tree) EventUpdateTree

type EventUpdateTreeCluster added in v1.1.0

type EventUpdateTreeCluster struct {
	BasicEvent
	Prev *TreeCluster
	New  *TreeCluster
}

func NewEventUpdateTreeCluster added in v1.1.0

func NewEventUpdateTreeCluster(prev, newTc *TreeCluster) EventUpdateTreeCluster

type EventUpdateWateringPlan added in v1.1.0

type EventUpdateWateringPlan struct {
	BasicEvent
	Prev *WateringPlan
	New  *WateringPlan
}

func NewEventUpdateWateringPlan added in v1.1.0

func NewEventUpdateWateringPlan(prev, newWp *WateringPlan) EventUpdateWateringPlan

type GeoJSON added in v1.1.0

type GeoJSON struct {
	Type     GeoJSONType      `json:"type"`
	Bbox     []float64        `json:"bbox"`
	Features []GeoJSONFeature `json:"features"`
	Metadata GeoJSONMetadata  `json:"metadata"`
}

type GeoJSONFeature added in v1.1.0

type GeoJSONFeature struct {
	Type       GeoJSONType     `json:"type"`
	Bbox       []float64       `json:"bbox"`
	Properties map[string]any  `json:"properties"`
	Geometry   GeoJSONGeometry `json:"geometry"`
}

type GeoJSONGeometry added in v1.1.0

type GeoJSONGeometry struct {
	Type        GeoJSONType `json:"type"`
	Coordinates [][]float64 `json:"coordinates"`
}

type GeoJSONLocation added in v1.1.0

type GeoJSONLocation struct {
	Latitude  float64
	Longitude float64
}

type GeoJSONMetadata added in v1.1.0

type GeoJSONMetadata struct {
	StartPoint    GeoJSONLocation
	EndPoint      GeoJSONLocation
	WateringPoint GeoJSONLocation
}

type GeoJSONType added in v1.1.0

type GeoJSONType string
const (
	FeatureCollection GeoJSONType = "FeatureCollection"
	Feature           GeoJSONType = "Feature"
	LineString        GeoJSONType = "LineString"
)

type Git

type Git struct {
	Branch     string
	Commit     string
	Repository *url.URL
}

type IntroSpectTokenResult

type IntroSpectTokenResult struct {
	Exp      *int
	Active   *bool
	AuthTime *int
	Type     *string
}

type LoginCallback

type LoginCallback struct {
	Code        string `validate:"required"`
	RedirectURL *url.URL
}

type LoginRequest

type LoginRequest struct {
	RedirectURL *url.URL
}

type LoginResp

type LoginResp struct {
	LoginURL *url.URL
}

type Logout

type Logout struct {
	RefreshToken string `validate:"required"`
}

type Map added in v1.2.0

type Map struct {
	Center [2]float64
	BBox   [4]float64
}

type MqttPayload

type MqttPayload struct {
	Device      string `validate:"required"`
	Battery     float64
	Humidity    float64
	Temperature float64
	Latitude    float64 `validate:"omitempty,min=-90,max=90"`
	Longitude   float64 `validate:"omitempty,min=-180,max=180"`
	Watermarks  []Watermark
}

type Plugin added in v1.1.0

type Plugin struct {
	Slug        string `validate:"required"`
	Name        string `validate:"required"`
	Path        url.URL
	Version     string
	Description string
	Auth        AuthPlugin
}

type Query added in v1.2.0

type Query struct {
	Provider string `query:"provider"`
}

type Region

type Region struct {
	ID        int32
	CreatedAt time.Time
	UpdatedAt time.Time
	Name      string
}

type RegionEvaluation added in v1.2.0

type RegionEvaluation struct {
	Name              string
	WateringPlanCount int64
}

type RegisterUser

type RegisterUser struct {
	User     User
	Password string `validate:"required"`
	Roles    []string
}

type RouteMetadata added in v1.1.0

type RouteMetadata struct {
	Distance float64
	Refills  int32
	Time     time.Duration
}

type Sensor

type Sensor struct {
	ID             string
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Status         SensorStatus
	LatestData     *SensorData
	Latitude       float64
	Longitude      float64
	Provider       string
	AdditionalInfo map[string]interface{}
}

type SensorCreate added in v1.1.0

type SensorCreate struct {
	ID             string       `validate:"required"`
	Status         SensorStatus `validate:"oneof=online offline unknown"`
	LatestData     *SensorData
	Latitude       float64 `validate:"required,max=90,min=-90"`
	Longitude      float64 `validate:"required,max=180,min=-180"`
	Provider       string
	AdditionalInfo map[string]interface{}
}

type SensorData

type SensorData struct {
	ID        int32
	SensorID  string
	CreatedAt time.Time
	UpdatedAt time.Time
	Data      *MqttPayload
}

type SensorStatus

type SensorStatus string
const (
	SensorStatusOnline  SensorStatus = "online"
	SensorStatusOffline SensorStatus = "offline"
	SensorStatusUnknown SensorStatus = "unknown"
)

type SensorUpdate added in v1.1.0

type SensorUpdate struct {
	Status         SensorStatus `validate:"oneof=online offline unknown"`
	LatestData     *SensorData
	Latitude       float64 `validate:"required,max=90,min=-90"`
	Longitude      float64 `validate:"required,max=180,min=-180"`
	Provider       string
	AdditionalInfo map[string]interface{}
}

type Server

type Server struct {
	OS        string
	Arch      string
	Hostname  string
	URL       *url.URL
	IP        net.IP
	Port      int
	Interface string
	Uptime    time.Duration
}

type Tree

type Tree struct {
	ID             int32
	CreatedAt      time.Time
	UpdatedAt      time.Time
	TreeCluster    *TreeCluster
	Sensor         *Sensor
	PlantingYear   int32
	Species        string
	Number         string
	Latitude       float64
	Longitude      float64
	WateringStatus WateringStatus
	Description    string
	LastWatered    *time.Time
	Provider       string
	AdditionalInfo map[string]interface{}
}

type TreeCluster

type TreeCluster struct {
	ID             int32
	CreatedAt      time.Time
	UpdatedAt      time.Time
	WateringStatus WateringStatus
	LastWatered    *time.Time
	MoistureLevel  float64
	Region         *Region
	Address        string
	Description    string
	Archived       bool
	Latitude       *float64
	Longitude      *float64
	Trees          []*Tree
	SoilCondition  TreeSoilCondition
	Name           string
	Provider       string
	AdditionalInfo map[string]interface{}
}

type TreeClusterCreate

type TreeClusterCreate struct {
	Address        string
	Description    string
	Name           string `validate:"required"`
	SoilCondition  TreeSoilCondition
	TreeIDs        []*int32
	Provider       string
	AdditionalInfo map[string]interface{}
}

type TreeClusterQuery added in v1.2.0

type TreeClusterQuery struct {
	WateringStatuses []WateringStatus `query:"watering_statuses"`
	Regions          []string         `query:"regions"`
	Query
}

type TreeClusterUpdate

type TreeClusterUpdate struct {
	Address        string
	Description    string
	SoilCondition  TreeSoilCondition
	TreeIDs        []*int32
	Name           string `validate:"required"`
	Provider       string
	AdditionalInfo map[string]interface{}
}

type TreeCreate

type TreeCreate struct {
	TreeClusterID  *int32
	SensorID       *string
	PlantingYear   int32 `validate:"required"`
	Species        string
	Number         string  `validate:"required"`
	Latitude       float64 `validate:"required,max=90,min=-90"`
	Longitude      float64 `validate:"required,max=180,min=-180"`
	Description    string
	Provider       string
	AdditionalInfo map[string]interface{}
}

type TreeQuery added in v1.2.0

type TreeQuery struct {
	WateringStatuses []WateringStatus `query:"watering_statuses"`
	HasCluster       *bool            `query:"has_cluster"`
	PlantingYears    []int32          `query:"planting_years"`
	Query
}

type TreeSoilCondition

type TreeSoilCondition string
const (
	TreeSoilConditionSchluffig TreeSoilCondition = "schluffig"
	TreeSoilConditionSandig    TreeSoilCondition = "sandig"
	TreeSoilConditionLehmig    TreeSoilCondition = "lehmig"
	TreeSoilConditionTonig     TreeSoilCondition = "tonig"
	TreeSoilConditionUnknown   TreeSoilCondition = "unknown"
)

type TreeUpdate

type TreeUpdate struct {
	TreeClusterID  *int32
	SensorID       *string
	PlantingYear   int32 `validate:"gt=0"`
	Species        string
	Number         string
	Latitude       float64 `validate:"omitempty,min=-90,max=90"`
	Longitude      float64 `validate:"omitempty,min=-180,max=180"`
	Description    string
	Provider       string
	AdditionalInfo map[string]interface{}
}

type User

type User struct {
	ID              uuid.UUID
	CreatedAt       time.Time
	Username        string `validate:"required,min=3,max=15"`
	FirstName       string `validate:"required,min=3,max=30"`
	LastName        string `validate:"required,min=3,max=30"`
	Email           string `validate:"required,email"`
	EmployeeID      string
	PhoneNumber     string
	EmailVerified   bool
	Roles           []UserRole
	Avatar          *url.URL
	DrivingLicenses []DrivingLicense
	Status          UserStatus
}

type UserRole added in v1.1.0

type UserRole string
const (
	UserRoleTbz               UserRole = "tbz"
	UserRoleGreenEcolution    UserRole = "green-ecolution"
	UserRoleSmarteGrenzregion UserRole = "smarte-grenzregion"
	UserRoleUnknown           UserRole = "unknown"
)

func ParseUserRole added in v1.2.0

func ParseUserRole(role string) UserRole

type UserStatus added in v1.1.0

type UserStatus string
const (
	UserStatusAvailable UserStatus = "available"
	UserStatusAbsent    UserStatus = "absent"
	UserStatusUnknown   UserStatus = "unknown"
)

func ParseUserStatus added in v1.1.0

func ParseUserStatus(status string) UserStatus

type Vehicle

type Vehicle struct {
	ID             int32
	CreatedAt      time.Time
	UpdatedAt      time.Time
	ArchivedAt     time.Time
	NumberPlate    string
	Description    string
	WaterCapacity  float64
	Status         VehicleStatus
	Type           VehicleType
	Model          string
	DrivingLicense DrivingLicense
	Height         float64
	Width          float64
	Length         float64
	Weight         float64
	Provider       string
	AdditionalInfo map[string]interface{}
}

type VehicleCreate added in v1.1.0

type VehicleCreate struct {
	NumberPlate    string `validate:"required"`
	Description    string
	WaterCapacity  float64        `validate:"gt=0"`
	Status         VehicleStatus  `validate:"oneof=active available 'not available' unknown"`
	Type           VehicleType    `validate:"oneof=transporter trailer unknown"`
	Model          string         `validate:"required"`
	DrivingLicense DrivingLicense `validate:"oneof=B BE C CE"`
	Height         float64        `validate:"gt=0"`
	Width          float64        `validate:"gt=0"`
	Length         float64        `validate:"gt=0"`
	Weight         float64        `validate:"gt=0"`
	Provider       string
	AdditionalInfo map[string]interface{}
}

type VehicleEvaluation added in v1.2.0

type VehicleEvaluation struct {
	NumberPlate       string
	WateringPlanCount int64
}

type VehicleQuery added in v1.2.0

type VehicleQuery struct {
	Type         string `query:"type"`
	WithArchived bool   `query:"archived"`
	Query
}

type VehicleStatus added in v1.1.0

type VehicleStatus string
const (
	VehicleStatusActive       VehicleStatus = "active"
	VehicleStatusAvailable    VehicleStatus = "available"
	VehicleStatusNotAvailable VehicleStatus = "not available"
	VehicleStatusUnknown      VehicleStatus = "unknown"
)

type VehicleType added in v1.1.0

type VehicleType string
const (
	VehicleTypeTransporter VehicleType = "transporter"
	VehicleTypeTrailer     VehicleType = "trailer"
	VehicleTypeUnknown     VehicleType = "unknown"
)

func ParseVehicleType added in v1.2.0

func ParseVehicleType(vehicleTypeStr string) VehicleType

type VehicleUpdate added in v1.1.0

type VehicleUpdate struct {
	NumberPlate    string `validate:"required"`
	Description    string
	WaterCapacity  float64        `validate:"gt=0"`
	Status         VehicleStatus  `validate:"oneof=active available 'not available' unknown"`
	Type           VehicleType    `validate:"oneof=transporter trailer unknown"`
	Model          string         `validate:"required"`
	DrivingLicense DrivingLicense `validate:"oneof=B BE C CE"`
	Height         float64        `validate:"gt=0"`
	Width          float64        `validate:"gt=0"`
	Length         float64        `validate:"gt=0"`
	Weight         float64        `validate:"gt=0"`
	Provider       string
	AdditionalInfo map[string]interface{}
}

type WateringPlan added in v1.1.0

type WateringPlan struct {
	ID                 int32
	CreatedAt          time.Time
	UpdatedAt          time.Time
	Date               time.Time
	Description        string
	Status             WateringPlanStatus
	Distance           *float64
	TotalWaterRequired *float64
	UserIDs            []*uuid.UUID
	TreeClusters       []*TreeCluster
	Transporter        *Vehicle
	Trailer            *Vehicle
	CancellationNote   string
	Evaluation         []*EvaluationValue
	GpxURL             string
	RefillCount        int32
	Duration           time.Duration
	Provider           string
	AdditionalInfo     map[string]interface{}
}

type WateringPlanCreate added in v1.1.0

type WateringPlanCreate struct {
	Date           time.Time `validate:"required"`
	Description    string
	TreeClusterIDs []*int32 `validate:"required,min=1,dive,required"`
	TransporterID  *int32   `validate:"required"`
	TrailerID      *int32
	UserIDs        []*uuid.UUID `validate:"required,min=1,dive,required"`
	Provider       string
	AdditionalInfo map[string]interface{}
}

type WateringPlanStatus added in v1.1.0

type WateringPlanStatus string
const (
	WateringPlanStatusPlanned     WateringPlanStatus = "planned"
	WateringPlanStatusActive      WateringPlanStatus = "active"
	WateringPlanStatusCanceled    WateringPlanStatus = "canceled"
	WateringPlanStatusFinished    WateringPlanStatus = "finished"
	WateringPlanStatusNotCompeted WateringPlanStatus = "not competed"
	WateringPlanStatusUnknown     WateringPlanStatus = "unknown"
)

type WateringPlanUpdate added in v1.1.0

type WateringPlanUpdate struct {
	Date             time.Time `validate:"required"`
	Description      string
	TreeClusterIDs   []*int32 `validate:"required,min=1,dive,required"`
	TransporterID    *int32   `validate:"required"`
	TrailerID        *int32
	CancellationNote string
	Status           WateringPlanStatus `validate:"oneof=planned active canceled finished 'not competed' unknown"`
	Evaluation       []*EvaluationValue
	UserIDs          []*uuid.UUID `validate:"required,min=1,dive,required"`
	Provider         string
	AdditionalInfo   map[string]interface{}
}

type WateringStatus

type WateringStatus string
const (
	WateringStatusGood        WateringStatus = "good"
	WateringStatusModerate    WateringStatus = "moderate"
	WateringStatusBad         WateringStatus = "bad"
	WateringStatusJustWatered WateringStatus = "just watered"
	WateringStatusUnknown     WateringStatus = "unknown"
)

type Watermark added in v1.1.0

type Watermark struct {
	Centibar   int
	Resistance int
	Depth      int
}

Jump to

Keyboard shortcuts

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