service

package
v0.0.0-...-055cc3d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert interface {
	List(userID uint) ([]model.Alert, error)
	Create(userID uint, payload dto.CreateAlertRequest) (model.Alert, error)
	Update(userID, alertID uint, payload dto.UpdateAlertRequest) (model.Alert, error)
	Delete(userID, alertID uint) error
	Owns(userID uint, alertID uint) (bool, error)

	Check(reading model.Reading) error
}

type Device

type Device interface {
	List(userID uint) ([]model.Device, error)
	Create(userID uint, payload dto.CreateDeviceRequest) (model.Device, error)
	Update(userID uint, deviceID uint, payload dto.UpdateDeviceRequest) (model.Device, error)
	Delete(userID uint, deviceID uint) error
	Owns(userID uint, deviceID uint) (bool, error)

	Get(token string) (model.Device, error)
	Watch() error
}

type Ownership

type Ownership interface {
	ListMembers(requesterID, deviceID uint) ([]*model.Ownership, error)
	AddMember(requesterID, deviceID uint, email string, role model.OwnershipRole) error
	RemoveMember(requesterID, deviceID uint, userID uint) error
}

type Phone

type Phone interface {
	Add(userID uint, pushID, pushToken string) (model.Phone, error)
	Remove(userID uint, pushID string) error
}

type Reading

type Reading interface {
	List(userID, deviceID uint, start, end time.Time) ([]model.Reading, error)
	Handle(message mqtt.Message) error
}

type Services

type Services interface {
	User() User
	Ownership() Ownership
	Device() Device
	Reading() Reading
	Alert() Alert
	Phone() Phone
}

func NewServices

func NewServices(repositories repository.Repositories, config dto.Config, clients client.Clients) Services

type User

type User interface {
	Login(email string, password string) (string, error)
	Register(email string, password string) (string, error)
	DecodeToken(token string) (uint, error)
	Authenticate(token string) (model.User, error)
}

Jump to

Keyboard shortcuts

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