controllers

package
v0.0.0-...-4382370 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorInsufficientPermission = "INSUFFICIENT_PERMISSION"

ErrorInsufficientPermission -> INSUFFICIENT_PERMISSION

View Source
const ErrorInvalidCredentials = "INVALID_CREDENTIALS"

ErrorInvalidCredentials -> INVALID_CREDENTIALS

View Source
const ErrorInvalidField = "INVALID_FIELD"

ErrorInvalidField -> INVALID_FIELD

View Source
const ErrorInvalidParameter = "INVALID_PARAMETER"

ErrorInvalidParameter -> INVALID_PARAMETER

View Source
const ErrorInvalidPayload = "INVALID_JSON"

ErrorInvalidPayload -> INVALID_JSON

View Source
const ErrorInvalidRequest = "INVALID_REQUEST"

ErrorInvalidRequest -> INVALID_REQUEST

View Source
const ErrorNotFound = "NOT_FOUND"

ErrorNotFound -> NOT_FOUND

View Source
const ErrorUnexpectedError = "UNEXPECTED_ERROR"

ErrorUnexpectedError -> UNEXPECTED_ERROR

Variables

This section is empty.

Functions

func Accepted

func Accepted(ctx iris.Context, response interface{})

Accepted -> 202

func BadRequest

func BadRequest(ctx iris.Context, validationsErros []ValidationError)

BadRequest -> stop with 400

func Conflict

func Conflict(ctx iris.Context, message string)

Conflict -> stop with 409

func Created

func Created(ctx iris.Context, response interface{})

Created -> 201

func DeleteVehicle

func DeleteVehicle(ctx iris.Context)

DeleteVehicle -> DELETE /v1/vehicles/{id}

func Forbidden

func Forbidden(ctx iris.Context)

Forbidden -> stop with 403

func GetCurrentUserFromContext

func GetCurrentUserFromContext(ctx iris.Context) *users.UserClaims

GetCurrentUserFromContext -> retrive user data from context

func GetUser

func GetUser(ctx iris.Context)

GetUser -> GET /v1/users

func GetUserVehicles

func GetUserVehicles(ctx iris.Context)

GetUserVehicles -> GET /v1/users/{id}/vehicles

func GetVehicle

func GetVehicle(ctx iris.Context)

GetVehicle -> GET /v1/vehicles

func GetVehicleByID

func GetVehicleByID(ctx iris.Context)

GetVehicleByID -> GET /v1/vehicles/{id}

func InternalServerError

func InternalServerError(ctx iris.Context, code string, err error)

InternalServerError -> stop with 500

func Login

func Login(ctx iris.Context)

Login -> POST /auth/login

func NoContent

func NoContent(ctx iris.Context)

NoContent -> 204

func NotFound

func NotFound(ctx iris.Context, message string)

NotFound -> stop with 404

func Ok

func Ok(ctx iris.Context, response interface{})

Ok -> 200

func PaginateTraces

func PaginateTraces(ctx iris.Context)

PaginateTraces -> GET /vehicles/{id}/traces?page=1&page_size=50

func PatchUser

func PatchUser(ctx iris.Context)

PatchUser -> GET /v1/users/{id}/active | /v1/users/{id}/inactive

func PatchVehicle

func PatchVehicle(ctx iris.Context)

PatchVehicle -> PATCH /v1/vehicles/{id}/active | /v1/vehicles/{id}/active

func PostTrace

func PostTrace(ctx iris.Context)

PostTrace -> /vehicles/{id}/traces

func PostTraceFromCSV

func PostTraceFromCSV(ctx iris.Context)

PostTraceFromCSV -> /vehicles/{id}/traces/upload

func PostVehicle

func PostVehicle(ctx iris.Context)

PostVehicle -> POST /v1/vehicles

func PutVehicle

func PutVehicle(ctx iris.Context)

PutVehicle -> PUT /v1/vehicles/{id}

func Register

func Register(ctx iris.Context)

Register -> POST /auth/register

func Unauthorized

func Unauthorized(ctx iris.Context, validationsErros []ValidationError)

Unauthorized -> stop with 401

func UnprocessableEntity

func UnprocessableEntity(ctx iris.Context, errs validator.ValidationErrors)

UnprocessableEntity -> stop with 422

Types

type ValidationError

type ValidationError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

ValidationError -> represent error

func MakeValidationError

func MakeValidationError(errorCode string, errorMessage string) []ValidationError

MakeValidationError -> mapping validator to json

func MakeValidationErrors

func MakeValidationErrors(errs validator.ValidationErrors) []ValidationError

MakeValidationErrors -> mapping validator to json

Jump to

Keyboard shortcuts

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