controllers

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateQueryParams added in v0.1.6

func ValidateQueryParams(p *QueryValues, c *fiber.Ctx) error

Types

type DailyDistanceDay added in v0.1.6

type DailyDistanceDay struct {
	Date     string   `json:"date"`
	Distance *float64 `json:"distance"`
}

type DailyDistanceResp added in v0.1.6

type DailyDistanceResp struct {
	Days []DailyDistanceDay `json:"days"`
}

type DataDownloadController added in v0.1.6

type DataDownloadController struct {
	QuerySvc   *services.DataQueryService
	StorageSvc *services.StorageService
	EmailSvc   *services.EmailService
	// contains filtered or unexported fields
}

DataDownloadController provides endpoints for user to download their data or save it (encrypted) to IPFS

func NewDataDownloadController added in v0.1.6

func NewDataDownloadController(settings *config.Settings, log *zerolog.Logger, esClient8 *es8.TypedClient, deviceAPIService services.DeviceAPIService) *DataDownloadController

func (*DataDownloadController) JSONDownloadHandler added in v0.1.6

func (d *DataDownloadController) JSONDownloadHandler(c *fiber.Ctx) error

JSONDownloadHandler godoc @Description returns user data as json @Tags device-data @Produce json @Success 200 @Router /user/device-data/:userDeviceID/export/json/email [get]

type DeviceDataController

type DeviceDataController struct {
	Settings *config.Settings
	// contains filtered or unexported fields
}

func NewDeviceDataController

func NewDeviceDataController(
	settings *config.Settings,
	logger *zerolog.Logger,
	deviceAPIService services.DeviceAPIService,
	es *elasticsearch.Client,
	es8Client *es8.TypedClient,
) DeviceDataController

NewDeviceDataController constructor

func (*DeviceDataController) GetDailyDistance added in v0.1.6

func (d *DeviceDataController) GetDailyDistance(c *fiber.Ctx) error

GetDailyDistance godoc @Description Get kilometers driven for a userDeviceID each day. @Tags device-data @Produce json @Success 200 {object} controllers.DailyDistanceResp @Failure 404 "no device found for user with provided parameters" @Param userDeviceID path string true "user device id" @Param time_zone query string true "IANAS time zone id, e.g., America/Los_Angeles" @Security BearerAuth @Router /user/device-data/{userDeviceID}/daily-distance [get]

func (*DeviceDataController) GetDistanceDriven added in v0.1.4

func (d *DeviceDataController) GetDistanceDriven(c *fiber.Ctx) error

GetDistanceDriven godoc @Description Get kilometers driven for a userDeviceID since connected (ie. since we have data available) @Description if it returns 0 for distanceDriven it means we have no odometer data. @Tags device-data @Produce json @Success 200 @Failure 404 "no device found for user with provided parameters" @Param userDeviceID path string true "user device id" @Security BearerAuth @Router /user/device-data/{userDeviceID}/distance-driven [get]

func (*DeviceDataController) GetHistoricalRaw

func (d *DeviceDataController) GetHistoricalRaw(c *fiber.Ctx) error

GetHistoricalRaw godoc @Description Get all historical data for a userDeviceID, within start and end range @Tags device-data @Produce json @Success 200 @Param userDeviceID path string true "user id" @Param startDate query string false "startDate eg 2022-01-02. if empty two weeks back" @Param endDate query string false "endDate eg 2022-03-01. if empty today" @Security BearerAuth @Router /user/device-data/{userDeviceID}/historical [get]

type QueryValues added in v0.1.6

type QueryValues struct {
	RangeStart    string `query:"rangestart"`
	RangeEnd      string `query:"rangeend"`
	EncryptionKey string `json:"encryptionkey"`
	IPFS          bool   `json:"ipfs"`
}

Jump to

Keyboard shortcuts

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