api

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EchoRoute              = "/echo"
	MapRoute               = "/map"
	LoginRoute             = "/login"
	UserRoute              = "/user"
	UserRouteWithParams    = UserRoute + "/:" + UUIDParam
	VehicleRoute           = "/vehicle"
	VehicleRouteWithParams = VehicleRoute + "/:" + UUIDParam
	APIKeyRoute            = "/keys"
	APIKeyRouteWithParams  = APIKeyRoute + "/:" + UUIDParam
	LocationRoute          = "/location"
	ExportRoute            = "/export"
	RoutePlanningRoute     = "/route"
)

Vehicles API keys can: - [ ] Notify location - [ ] Plan route

Public - [X] Download map - [X] Login

Admin user can: - [X] CRUD users - [X] CRUD vehicles - [X] CRUD API keys - [ ] Monitor location - [ ] Export data

Manager user can: - [ ] Monitor location - [ ] Export data

View Source
const (
	CredentialsKey = "CREDENTIALS_KEY"
)
View Source
const (
	RootRoute = "/api"
)
View Source
const (
	UUIDParam = "uuid"
)

Variables

View Source
var (
	StatusOK = Status{
		Succeed: true,
		Error:   "Operation succeed",
	}
	UnauthorizedStatus = Status{
		Succeed: false,
		Error:   "Unauthorized",
	}
	ForbiddenStatus = Status{
		Succeed: false,
		Error:   "Forbidden",
	}
)

Functions

func New

func NewTest

func NewTest(t *testing.T) (*controller.Controller, *httpexpect.Expect, func())

Types

type Handler

type Handler struct {
	Controller *controller.Controller
}

func (*Handler) CreateAPIKey

func (h *Handler) CreateAPIKey(ctx *gin.Context)

func (*Handler) CreateUser

func (h *Handler) CreateUser(ctx *gin.Context)

func (*Handler) CreateVehicle

func (h *Handler) CreateVehicle(ctx *gin.Context)

func (*Handler) DeleteAPIKey

func (h *Handler) DeleteAPIKey(ctx *gin.Context)

func (*Handler) DeleteUser

func (h *Handler) DeleteUser(ctx *gin.Context)

func (*Handler) DeleteVehicle

func (h *Handler) DeleteVehicle(ctx *gin.Context)

func (*Handler) Echo

func (h *Handler) Echo(ctx *gin.Context)

func (*Handler) Login

func (h *Handler) Login(ctx *gin.Context)

func (*Handler) Map

func (h *Handler) Map(ctx *gin.Context)

func (*Handler) QueryAPIKeys

func (h *Handler) QueryAPIKeys(ctx *gin.Context)

func (*Handler) QueryUsers

func (h *Handler) QueryUsers(ctx *gin.Context)

func (*Handler) QueryVehicles

func (h *Handler) QueryVehicles(ctx *gin.Context)

func (*Handler) UpdateUser

func (h *Handler) UpdateUser(ctx *gin.Context)

func (*Handler) UpdateVehicle

func (h *Handler) UpdateVehicle(ctx *gin.Context)

type JWTResponse

type JWTResponse struct {
	JWT string `json:"jwt"`
}

type Status

type Status struct {
	Succeed bool   `json:"succeed"`
	Error   string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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