handlers

package
v0.0.0-...-8681122 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCompany

func CreateCompany(c echo.Context) error

CreateCompany Use curl: curl -v POST http://localhost:8080/v0.9/company/ -H 'Content-Type: application/json' -d '{"name":"my_company","code":"23323","country":"Ukraine","website":"https://something.com","phone":"23323"}'

func CreateUser

func CreateUser(c echo.Context) error

CreateUser Use curl: curl -v POST http://localhost:8080/v0.9/user/register -H 'Content-Type: application/json' -d '{"userName":"my_login","password":"my_password"}'

func DeleteCompany

func DeleteCompany(c echo.Context) error

DeleteCompany Use curl: curl -v DELETE http://localhost:8080/v0.9/company/86e9860c-d11b-4317-7625-c95ee3db87c7

func FindCompanyByField

func FindCompanyByField(c echo.Context) error

FindCompany Use curl: curl -v GET http://localhost:8080/v0.9/company?field=code&value=23323

func ListCompanies

func ListCompanies(c echo.Context) error

ListCompanies Use curl: curl -v GET http://localhost:8080/v0.9/company/

func LoginUser

func LoginUser(c echo.Context) error

LoginUser Use curl: curl -v POST http://localhost:8080/v0.9/user/login -H 'Content-Type: application/json' -d '{"userName":"my_login","password":"my_password"}'

func LogoutUser

func LogoutUser(c echo.Context) error

LogoutUser Use curl: curl -v POST http://localhost:8080/v1/user/logout -H 'Content-Type: application/json' -d '{"userName":"access_token","password":"my_access_token"}'

func UpdateCompany

func UpdateCompany(c echo.Context) error

UpdateCompanyResponse Use curl: curl -v PUT http://localhost:8080/v0.9/company/ -H 'Content-Type: application/json' -d '{"id":"6e52a033-c6e9-4305-51a6-59f00bb108b3","name":"my_company","code":"23323","country":"Ukraine","website":"https://something.com","phone":"23323"}'

Types

type AccessToken

type AccessToken struct {
	Token string `json:"token"`
}

type CompanyRequest

type CompanyRequest struct {
	Token   string `json:"token"`
	Id      string `json:"id"`
	Name    string `json:"name" validate:"required,min=1,max=100"`
	Code    string `json:"code" validate:"required,min=1,max=100"`
	Country string `json:"country" validate:"required,min=1,max=20"`
	Website string `json:"website" validate:"required,min=1,max=100"`
	Phone   string `json:"phone" validate:"required,min=1,max=16"`
}

CompanyRequest defines model for CompanyRequest.

type CreateCompanyResponse

type CreateCompanyResponse struct {
	Id          string `json:"id"`
	CompanyName string `json:"company_name"`
}

CreateCompanyResponse defines model for CreateCompanyResponse.

type CreateUserResponse

type CreateUserResponse struct {
	Id       string `json:"id"`
	UserName string `json:"user_name"`
}

CreateUserResponse defines model for CreateUserResponse.

type DeleteCompanyResponse

type DeleteCompanyResponse struct {
	Msg string `json:"msg"`
}

DeleteCompanyResponse defines model for DeleteCompanyResponse.

type LoginUserResponse

type LoginUserResponse struct {
	AccessToken string `json:"token"`
}

LoginUserResponse defines model for LoginUserResponse.

type LogoutUserRequest

type LogoutUserRequest struct {
	AccessToken string `json:"token"`
}

LogoutUserRequest defines model for LogoutUserRequest.

type LogoutUserResponse

type LogoutUserResponse struct {
	Msg string `json:"msg"`
}

LogoutUserResponse defines model for LoginUserResponse.

type UpdateCompanyResponse

type UpdateCompanyResponse struct {
	Id          string `json:"id"`
	CompanyName string `json:"company_name"`
}

UpdateCompanyResponse defines model for UpdateCompanyResponse.

type UserRequest

type UserRequest struct {
	UserName string `json:"user_name" validate:"required,min=4,max=100"`
	Password string `json:"password" validate:"required,min=8,max=100"`
}

UserRequest defines model for UserRequest.

Jump to

Keyboard shortcuts

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