models

package
v0.0.0-...-4cefa3e Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventActionPlantWater        = "PLANT_WATER"
	EventActionPlantCapturePhoto = "PLANT_CAPTURE_PHOTO"
	EventActionRobotRandomMove   = "ROBOT_RANDOM_MOVE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID          int            `json:"id" db:"id"`
	Summary     string         `json:"summary" db:"summary"`
	Recurrences pq.StringArray `json:"recurrences" db:"recurrence"`
	UserID      int            `json:"user_id" db:"user_id"`
	Ephemeral   bool           `json:"ephemeral,omitempty" db:"ephemeral"`
}

type EventAction

type EventAction struct {
	ID      int            `json:"id" db:"id"`
	Name    string         `json:"name" db:"name"`
	Data    types.JSONText `json:"data" db:"data"`
	PlantID *int           `json:"plant_id,omitempty" db:"plant_id"`
	RobotID uuid.UUID      `json:"robot_id" db:"robot_id"`
	EventID int            `json:"event_id" db:"event_id"`
}

type Plant

type Plant struct {
	ID           int    `json:"id" db:"id"`
	Name         string `json:"name" db:"name"`
	UserID       int    `json:"user_id" db:"user_id"`
	SoilMoisture *int   `json:"soil_moisture" db:"soil_moisture"`
}

type PlantPhoto

type PlantPhoto struct {
	ID        int       `json:"id" db:"id"`
	Filename  uuid.UUID `json:"filename" db:"filename"`
	PlantID   int       `json:"plant_id" db:"plant_id"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
}

type Robot

type Robot struct {
	ID         uuid.UUID `json:"id" db:"id"`
	AdminToken string    `json:"-" db:"admin_token"`
	UserID     *int      `json:"user_id,omitempty" db:"user_id"`
	Title      *string   `json:"title,omitempty" db:"title"`

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

Robot is a single (potentially not-yet-activated) robot

type RobotState

type RobotState struct {
	ID           uuid.UUID `json:"id" db:"id"`
	BatteryLevel int       `json:"battery_level" db:"battery_level"`
	WaterLevel   int       `json:"water_level" db:"water_level"`
	Standby      bool      `json:"standby" db:"standby"`

	SeenAt *time.Time `json:"seen_at" db:"seen_at"`
}

RobotState represents the state of a rboto.

All fields are mandatory, except that seen_at has the special case where if it's `null`, the robot has not been "seen" yet. That is to say, the robot hasn't been turned on yet.

This is so that the interactive interfaces can report "Not seen yet" instead of just the default (blank) values.

type User

type User struct {
	ID        int    `json:"id" db:"id"`
	Forename  string `json:"forename" db:"forename"`
	Surname   string `json:"surname" db:"surname"`
	Password  string `json:"password" db:"password"`
	Email     string `json:"email" db:"email"`
	Activated bool   `json:"is_activated" db:"is_activated"`

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

User is a user account in the system

Jump to

Keyboard shortcuts

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