request

package
v0.0.0-...-ad0da93 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID(c echo.Context) (int, error)

ID returns id url parameter. In case of conversion error to int, StatusBadRequest will be returned as err

Types

type Credentials

type Credentials struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

Credentials contains login request

func Login

func Login(c echo.Context) (*Credentials, error)

Login validates login request

type Pagination

type Pagination struct {
	Limit  int `query:"limit"`
	Page   int `query:"page" validate:"min=0"`
	Offset int `json:"-"`
}

Pagination contains pagination request

func Paginate

func Paginate(c echo.Context) (*Pagination, error)

Paginate validates pagination requests

type Password

type Password struct {
	ID                 int    `json:"-"`
	OldPassword        string `json:"old_password" validate:"required,min=8"`
	NewPassword        string `json:"new_password" validate:"required,min=8"`
	NewPasswordConfirm string `json:"new_password_confirm" validate:"required"`
}

Password contains password change request

func PasswordChange

func PasswordChange(c echo.Context) (*Password, error)

PasswordChange validates password change request

type Register

type Register struct {
	FirstName       string `json:"first_name" validate:"required"`
	LastName        string `json:"last_name" validate:"required"`
	Username        string `json:"username" validate:"required,min=3,alphanum"`
	Password        string `json:"password" validate:"required,min=8"`
	PasswordConfirm string `json:"password_confirm" validate:"required"`
	Email           string `json:"email" validate:"required,email"`

	CompanyID  int `json:"company_id" validate:"required"`
	LocationID int `json:"location_id" validate:"required"`
	RoleID     int `json:"role_id" validate:"required"`
}

Register contains registration request

func AccountCreate

func AccountCreate(c echo.Context) (*Register, error)

AccountCreate validates account creation request

type UpdateUser

type UpdateUser struct {
	ID        int     `json:"-"`
	FirstName *string `json:"first_name,omitempty" validate:"omitempty,min=2"`
	LastName  *string `json:"last_name,omitempty" validate:"omitempty,min=2"`
	Mobile    *string `json:"mobile,omitempty"`
	Phone     *string `json:"phone,omitempty"`
	Address   *string `json:"address,omitempty"`
}

UpdateUser contains user update data from json request

func UserUpdate

func UserUpdate(c echo.Context) (*UpdateUser, error)

UserUpdate validates user update request

Jump to

Keyboard shortcuts

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