domain

package
v0.0.0-...-072db41 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AccountStatus_Values provides list of valid AccountStatus values.

AquaHubStatus_Values provides list of valid AquaHubStatus values.

UserAccountStatus_Values provides list of valid UserAccountStatus values.

Functions

func AccountStatus_ValuesInterface

func AccountStatus_ValuesInterface() []interface{}

AccountStatus_ValuesInterface returns the AccountStatus options as a slice interface.

func AquaHubStatus_ValuesInterface

func AquaHubStatus_ValuesInterface() []interface{}

AquaHubStatus_ValuesInterface returns the AquaHubStatus options as a slice interface.

Types

type Account

type Account struct {
	ID            int            `json:"id" validate:"required" example:"c4653bf9-5978-48b7-89c5-95704aebb7e2"`
	Name          string         `json:"name" validate:"required,unique" example:"Company Name"`
	Address1      string         `json:"address1" validate:"required" example:"221 Tatitlek Ave"`
	Address2      string         `json:"address2" validate:"omitempty" example:"Box #1832"`
	City          string         `json:"city" validate:"required" example:"Valdez"`
	Region        string         `json:"region" validate:"required" example:"AK"`
	Country       string         `json:"country" validate:"required" example:"USA"`
	Zipcode       string         `json:"zipcode" validate:"required" example:"99686"`
	Status        AccountStatus  `` /* 134-byte string literal not displayed */
	Timezone      string         `json:"timezone" validate:"omitempty" example:"America/Anchorage"`
	SignupUserID  *sql.NullInt64 `json:"signup_user_id,omitempty" validate:"omitempty" swaggertype:"string" example:"d69bdef7-173f-4d29-b52c-3edc60baf6a2"`
	BillingUserID *sql.NullInt64 `json:"billing_user_id,omitempty" validate:"omitempty" swaggertype:"string" example:"d69bdef7-173f-4d29-b52c-3edc60baf6a2"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	ArchivedAt    *pq.NullTime   `json:"archived_at,omitempty" swaggertype:"string"`
	UserToken     string         `json:"u_token" validate:"required" example:"U45tdq347f44SAd4"`
}

Account represents someone with access to our system.

type AccountStatus

type AccountStatus string

AccountStatus represents the status of an account.

const (
	// AccountStatus_Active defines the state when a user can access an account.
	AccountStatus_Active AccountStatus = "active"
	// AccountStatus_Pending defined the state when an account was created but
	// not activated.
	AccountStatus_Pending AccountStatus = "pending"
	// AccountStatus_Disabled defines the state when a user has been disabled from
	// accessing an account.
	AccountStatus_Disabled AccountStatus = "disabled"
)

AccountStatus values define the status field of a user account.

func (*AccountStatus) Scan

func (s *AccountStatus) Scan(value interface{}) error

Scan supports reading the AccountStatus value from the database.

func (AccountStatus) String

func (s AccountStatus) String() string

String converts the AccountStatus value to a string.

func (AccountStatus) Value

func (s AccountStatus) Value() (driver.Value, error)

Value converts the AccountStatus value to be stored in the database.

type AquaHubStatus

type AquaHubStatus string

AquaHubStatus represents the status of checklist.

const (
	// AquaHubStatus_Active defines the status of active for checklist.
	AquaHubStatus_Active AquaHubStatus = "active"
	// AquaHubStatus_Archived defines the status of disabled for checklist.
	AquaHubStatus_Archived AquaHubStatus = "archived"
)

AquaHubStatus values define the status field of checklist.

func (AquaHubStatus) String

func (s AquaHubStatus) String() string

String converts the AquaHubStatus value to a string.

type AquahubItem

type AquahubItem struct {
	Id          int    `json:"id" db:"id"`
	Title       string `json:"title" db:"title" binding:"required"`
	Description string `json:"description" db:"description"`
	Done        bool   `json:"done" db:"done"`
}

type AquahubList

type AquahubList struct {
	ID          int           `json:"id" db:"id" validate:"required"`
	AccountID   int           `json:"account_id" db:"account_id" validate:"required" truss:"api-create"`
	Title       string        `json:"title" db:"title" validate:"required" binding:"required"`
	Description string        `json:"description" db:"description" validate:"required"`
	Status      AquaHubStatus `` /* 130-byte string literal not displayed */
	CreatedAt   time.Time     `json:"created_at" db:"created_at" truss:"api-read"`
	UpdatedAt   time.Time     `json:"updated_at" db:"updated_at" truss:"api-read"`
	ArchivedAt  *pq.NullTime  `json:"archived_at,omitempty" db:"archived_at" truss:"api-hide" swaggertype:"string"`
}

ID string `json:"id" db:"id" validate:"required,uuid" example:"985f1746-1d9f-459f-a2d9-fc53ece5ae86"` Name string `json:"name" validate:"required" example:"Rocket Launch"`

type AquahubListFindRequest

type AquahubListFindRequest struct {
	Where           string        `json:"where" example:"name = ? and status = ?"`
	Args            []interface{} `json:"args" swaggertype:"array,string" example:"Moon Launch,active"`
	Order           []string      `json:"order" example:"created_at desc"`
	Limit           *uint         `json:"limit" example:"10"`
	Offset          *uint         `json:"offset" example:"20"`
	IncludeArchived bool          `json:"include-archived" example:"false"`
}

ChecklistFindRequest defines the possible options to search for checklists. By default archived checklist will be excluded from response.

type AquahubLists

type AquahubLists []*AquahubList

Checklists a list of Checklists.

type AquahubListsItem

type AquahubListsItem struct {
	Id     int
	ListId int
	ItemId int
}

type Cache

type Cache interface {
	Set(key string, value interface{})
	Get(key string) (interface{}, error)
	Delete(key string)
	Free()
}

type CfgApplication

type CfgApplication struct {
	Env       string `default:"dev" envconfig:"ENV"`
	HTTP      CfgHTTP
	HTTPS     CfgHTTPS
	Service   CfgService
	Project   CfgProject
	Redis     CfgRedis
	DB        CfgDB
	Trace     CfgTrace
	Aws       CfgAws
	Auth      CfgAuth
	Build     string
	BuildInfo CfgBuildInfo
}

type CfgAuth

type CfgAuth struct {
	UseAwsSecretManager bool          `default:"false" envconfig:"USE_AWS_SECRET_MANAGER"`
	KeyExpiration       time.Duration `default:"3600s" envconfig:"KEY_EXPIRATION"`
}

type CfgAws

type CfgAws struct {
	AccessKeyID                string `envconfig:"AWS_ACCESS_KEY_ID"`              // WEB_API_AWS_AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY_ID
	SecretAccessKey            string `envconfig:"AWS_SECRET_ACCESS_KEY" json:"-"` // don't print
	Region                     string `default:"us-west-2" envconfig:"AWS_DEFAULT_REGION"`
	S3BucketPrivate            string `envconfig:"S3_BUCKET_PRIVATE"`
	S3BucketPublic             string `envconfig:"S3_BUCKET_PUBLIC"`
	SecretsManagerConfigPrefix string `default:"" envconfig:"SECRETS_MANAGER_CONFIG_PREFIX"`

	// Get an AWS session from an implicit source if no explicit
	// configuration is provided. This is useful for taking advantage of
	// EC2/ECS instance roles.
	UseRole bool `envconfig:"AWS_USE_ROLE"`
}

type CfgBuildInfo

type CfgBuildInfo struct {
	CiCommitRefName  string `envconfig:"CI_COMMIT_REF_NAME"`
	CiCommitShortSha string `envconfig:"CI_COMMIT_SHORT_SHA"`
	CiCommitSha      string `envconfig:"CI_COMMIT_SHA"`
	CiCommitTag      string `envconfig:"CI_COMMIT_TAG"`
	CiJobId          string `envconfig:"CI_JOB_ID"`
	CiJobUrl         string `envconfig:"CI_JOB_URL"`
	CiPipelineId     string `envconfig:"CI_PIPELINE_ID"`
	CiPipelineUrl    string `envconfig:"CI_PIPELINE_URL"`
}

type CfgDB

type CfgDB struct {
	Host       string `default:"http://127.0.0.1:5432" envconfig:"HOST"`
	User       string `default:"postgres" envconfig:"USER"`
	Pass       string `default:"qwerty" envconfig:"PASS" json:"-"` // don't print
	Database   string `default:"postgres" envconfig:"DATABASE"`
	Driver     string `default:"postgres" envconfig:"DRIVER"`
	Timezone   string `default:"utc" envconfig:"TIMEZONE"`
	DisableTLS bool   `default:"true" envconfig:"DISABLE_TLS"`
}

type CfgHTTP

type CfgHTTP struct {
	Host         string        `default:"127.0.0.1:3000" envconfig:"HOST"`
	Port         string        `default:"3000" envconfig:"PORT"`
	ReadTimeout  time.Duration `default:"10s" envconfig:"READ_TIMEOUT"`
	WriteTimeout time.Duration `default:"10s" envconfig:"WRITE_TIMEOUT"`
}

type CfgHTTPS

type CfgHTTPS struct {
	Host         string        `default:"" envconfig:"HOST"`
	Port         string        `default:"" envconfig:"PORT"`
	ReadTimeout  time.Duration `default:"5s" envconfig:"READ_TIMEOUT"`
	WriteTimeout time.Duration `default:"5s" envconfig:"WRITE_TIMEOUT"`
}

type CfgProject

type CfgProject struct {
	Name              string `default:"" envconfig:"PROJECT_NAME"`
	SharedTemplateDir string `default:"../../resources/templates/shared" envconfig:"SHARED_TEMPLATE_DIR"`
	SharedSecretKey   string `default:"" envconfig:"SHARED_SECRET_KEY"`
	EmailSender       string `default:"test@example.com" envconfig:"EMAIL_SENDER"`
	WebApiBaseUrl     string `default:"http://127.0.0.1:3001" envconfig:"WEB_API_BASE_URL"  example:"http://api.example.com"`
}

type CfgRedis

type CfgRedis struct {
	Host            string        `default:"127.0.0.1:6379" envconfig:"HOST"`
	DB              int           `default:"1" envconfig:"DB"`
	DialTimeout     time.Duration `default:"5s" envconfig:"DIAL_TIMEOUT"`
	MaxmemoryPolicy string        `default:"allkeys-lru" envconfig:"MAXMEMORY_POLICY"`
}

type CfgService

type CfgService struct {
	Name        string   `default:"web-app" envconfig:"SERVICE_NAME"`
	BaseUrl     string   `default:"" envconfig:"BASE_URL"  example:"http://example.com"`
	HostNames   []string `envconfig:"HOST_NAMES" example:"www.example.com"`
	EnableHTTPS bool     `default:"false" envconfig:"ENABLE_HTTPS"`
	TemplateDir string   `default:"./templates" envconfig:"TEMPLATE_DIR"`
	StaticFiles struct {
		Dir               string `default:"./static" envconfig:"STATIC_DIR"`
		S3Enabled         bool   `envconfig:"S3_ENABLED"`
		S3Prefix          string `default:"public/web_app/static" envconfig:"S3_PREFIX"`
		CloudFrontEnabled bool   `envconfig:"CLOUDFRONT_ENABLED"`
		ImgResizeEnabled  bool   `envconfig:"IMG_RESIZE_ENABLED"`
	}
	Minify          bool          `envconfig:"MINIFY"`
	SessionName     string        `default:"" envconfig:"SESSION_NAME"`
	DebugHost       string        `default:"0.0.0.0:4000" envconfig:"DEBUG_HOST"`
	ShutdownTimeout time.Duration `default:"5s" envconfig:"SHUTDOWN_TIMEOUT"`
	ScaleToZero     time.Duration `envconfig:"SCALE_TO_ZERO"`
}

type CfgTrace

type CfgTrace struct {
	Host          string  `default:"127.0.0.1" envconfig:"DD_TRACE_AGENT_HOSTNAME"`
	Port          int     `default:"8126" envconfig:"DD_TRACE_AGENT_PORT"`
	AnalyticsRate float64 `default:"0.10" envconfig:"ANALYTICS_RATE"`
}

type Checklist

type Checklist struct {
	ID          int             `json:"id" db:"id" validate:"required" example:"1"`
	AccountID   int             `json:"-" db:"account_id" validate:"required" truss:"api-create"`
	Title       string          `json:"title" db:"title" validate:"required" example:"Rocket Launch"`
	Description string          `json:"description" db:"description" example:"Rocket Launch Description"`
	Status      ChecklistStatus `` /* 130-byte string literal not displayed */
	CreatedAt   time.Time       `json:"-" db:"created_at" truss:"api-read"`
	UpdatedAt   time.Time       `json:"updated_at" db:"updated_at" truss:"api-read"`
	ArchivedAt  *pq.NullTime    `json:"-" db:"archived_at" truss:"api-hide" swaggertype:"string"`
}

func (Checklist) Validate

func (i Checklist) Validate() error

type ChecklistItem

type ChecklistItem struct {
	ID          int          `json:"-" db:"id"`
	ChecklistID int          `json:"-" db:"checklist_id" validate:"required" truss:"api-create"`
	Title       string       `json:"title,omitempty" db:"title" validate:"required" example:"Rocket Launch"`
	Description string       `json:"description,omitempty" db:"description"`
	Done        bool         `json:"done,omitempty" db:"done"`
	CreatedAt   time.Time    `json:"-" db:"created_at" truss:"api-read"`
	UpdatedAt   time.Time    `json:"updated_at,omitempty" db:"updated_at" truss:"api-read"`
	ArchivedAt  *pq.NullTime `json:"-,omitempty" db:"archived_at" truss:"api-hide" swaggertype:"string"`
}

type ChecklistStatus

type ChecklistStatus string

ChecklistStatus represents the status of checklist.

type CreateChecklist

type CreateChecklist struct {
	Title       *string          `json:"title" binding:"required" validate:"required" example:"Title Checklist"`
	Description *string          `json:"description,omitempty" example:"Description Checklist"`
	Status      *ChecklistStatus `` /* 128-byte string literal not displayed */
}

type NameOfDeviceSensor

type NameOfDeviceSensor struct {
	NameDevice string
	NameSensor string
}

type SensorDataSet

type SensorDataSet struct {
	ID         int       `json:"id" db:"id"`
	Account_id int       `json:"account_id" db:"account_id"`
	Aquahub_id int       `json:"aquahub_id" db:"aquahub_id"`
	Device_id  int       `json:"device_id" db:"device_id"`
	Sensor_id  int       `json:"sensor_id" db:"sensor_id"`
	CreatedAt  time.Time `json:"created_at" db:"created_at"`
	User_time  time.Time `json:"user_time" db:"user_time"`

	// По запросу api_v1 приходят данные: Local_device_id, Local_sensor_id, Value
	Local_device_id int `json:"local_device_id" db:"local_device_id"`
	Local_sensor_id int `json:"local_sensor_id" db:"local_sensor_id"`

	Value string `json:"value" db:"value"`
}

type UpdateAquahubItemInput

type UpdateAquahubItemInput struct {
	Title       *string `json:"title"`
	Description *string `json:"description"`
	Done        *bool   `json:"done"`
}

func (UpdateAquahubItemInput) Validate

func (i UpdateAquahubItemInput) Validate() error

type UpdateAquahubListInput

type UpdateAquahubListInput struct {
	Title       *string `json:"title"`
	Description *string `json:"description"`
}

func (UpdateAquahubListInput) Validate

func (i UpdateAquahubListInput) Validate() error

type UpdateChecklist

type UpdateChecklist struct {
	ID          int              `json:"-"`
	Title       *string          `json:"title" example:"Title Checklist"`
	Description *string          `json:"description" example:"Description Checklist"`
	Status      *ChecklistStatus `` /* 128-byte string literal not displayed */
}

func (UpdateChecklist) Validate

func (i UpdateChecklist) Validate() error

type UpdateChecklistItem

type UpdateChecklistItem struct {
	Title       *string `json:"title"`
	Description *string `json:"description"`
	Done        *bool   `json:"done"`
}

func (UpdateChecklistItem) Validate

func (i UpdateChecklistItem) Validate() error

type User

type User struct {
	ID            int             `json:"-" validate:"required" db:"id" example:"1"`
	FirstName     string          `json:"first_name" validate:"required" db:"first_name" example:"Andy"`
	LastName      string          `json:"last_name" validate:"required" db:"last_name" example:"Sokol"`
	Email         string          `json:"email" validate:"required,email,unique" db:"email" example:"ae@ae.ae"`
	PasswordSalt  string          `json:"-" validate:"required" db:"password_salt"`
	PasswordHash  string          `json:"password" validate:"required" db:"password_hash"  example:"jyWtbKg76by"`
	PasswordReset *sql.NullString `json:"-" db:"password_reset"`
	Timezone      *string         `json:"-" validate:"omitempty" db:"timezone" example:"Europe/Kiev"`
	CreatedAt     time.Time       `json:"-" db:"created_at"`
	UpdatedAt     time.Time       `json:"-" db:"updated_at"`
	ArchivedAt    *pq.NullTime    `json:"-,omitempty" db:"archived_at" swaggertype:"string"`
}

func (User) Validate

func (v User) Validate() error

type UserAccount

type UserAccount struct {
	ID         int64             `json:"id" validate:"required" example:"72938896-a998-4258-a17b-6418dcdb80e3"`
	UserID     int               `json:"user_id" validate:"required" example:"d69bdef7-173f-4d29-b52c-3edc60baf6a2"`
	AccountID  int               `json:"account_id" validate:"required" example:"c4653bf9-5978-48b7-89c5-95704aebb7e2"`
	Roles      UserAccountRoles  `json:"roles" validate:"required,dive,oneof=manager user" enums:"manager,user" swaggertype:"array,string" example:"manager"`
	Status     UserAccountStatus `` /* 134-byte string literal not displayed */
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
	ArchivedAt *pq.NullTime      `json:"archived_at,omitempty" swaggertype:"string"`
}

UserAccount defines the one to many relationship of an user to an account. This will enable a single user access to multiple accounts without having duplicate users. Each association of a user to an account has a set of roles and a status defined for the user. The roles will be applied to enforce ACLs across the application. The status will allow users to be managed on by account with users being global to the application.

type UserAccountRole

type UserAccountRole string

UserAccountRole represents the role of a user for an account.

const (
	// UserAccountRole_Manager defines the state of a user when they have manager
	// privileges for accessing an account. This role provides a user with full
	// access to an account.
	UserAccountRole_Manager UserAccountRole = "Manager"
	// UserAccountRole_User defines the state of a user when they have basic
	// privileges for accessing an account. This role provies a user with the most
	// limited access to an account.
	UserAccountRole_User UserAccountRole = "User"
)

UserAccountRole values define the role field of a user account.

type UserAccountRoles

type UserAccountRoles []UserAccountRole

UserAccountRoles represents a set of roles for a user for an account.

type UserAccountStatus

type UserAccountStatus string

UserAccountStatus represents the status of a user for an account.

const (
	// UserAccountStatus_Active defines the state when a user can access an account.
	UserAccountStatus_Active UserAccountStatus = "active"
	// UserAccountStatus_Invited defined the state when a user has been invited to an
	// account.
	UserAccountStatus_Invited UserAccountStatus = "invited"
	// UserAccountStatus_Disabled defines the state when a user has been disabled from
	// accessing an account.
	UserAccountStatus_Disabled UserAccountStatus = "disabled"
)

UserAccountStatus values define the status field of a user account.

func (UserAccountStatus) String

func (s UserAccountStatus) String() string

String converts the UserAccountStatus value to a string.

Jump to

Keyboard shortcuts

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