middleware

package
v0.0.0-...-f18a37c Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind[T any](c *gin.Context)

func GetBoolArg

func GetBoolArg(c *gin.Context, key string) (*bool, error)

func GetData

func GetData[T any](c *gin.Context) (*T, error)

func GetDateTime

func GetDateTime(layout string, query string) (*int64, error)

func GetIntArg

func GetIntArg(c *gin.Context, key string, min int, max int) (*int, error)

func GetNPerPageValue

func GetNPerPageValue(c *gin.Context) (int64, error)

func IsProperObjectIDHex

func IsProperObjectIDHex(hex string) error

func RequireCustomerAuth

func RequireCustomerAuth(conns *mygrpc.GRPCConns) gin.HandlerFunc

func RequireOwnerAuth

func RequireOwnerAuth(conns *mygrpc.GRPCConns) gin.HandlerFunc

Types

type AuthHeader

type AuthHeader struct {
	Auth string `header:"Authorization" binding:"required"`
}

type CancelRequest

type CancelRequest struct {
	OrderID string `json:"order_id" binding:"required"`
}

type Company

type Company struct {
	Name             *string `json:"name" binding:"omitempty,max=30"`
	Type             *string `json:"type" binding:"omitempty,max=30"`
	Localisation     *string `json:"localisation" binding:"omitempty,max=60"`
	ShortDescription *string `json:"short_description" binding:"omitempty,max=150"`
	LongDescription  *string `json:"long_description" binding:"omitempty,max=300"`
}

type Customer

type Customer struct {
	ID      string
	Mail    string
	Name    string
	Surname string
}

func GetCustomer

func GetCustomer(c *gin.Context) (Customer, error)

type Employee

type Employee struct {
	Name       *string               `json:"name" binding:"omitempty,max=30"`
	Surname    *string               `json:"surname" binding:"omitempty,max=30"`
	WorkTimes  *strtime.WorkTimesStr `json:"work_times" binding:"omitempty"`
	Competence []string              `json:"competence" binding:"omitempty"`
}

type Order

type Order struct {
	CompanyID  string `json:"company_id" binding:"required"`
	ServiceID  string `json:"service_id" binding:"required"`
	EmployeeID string `json:"employee_id" binding:"required"`
	StartTime  string `json:"start_time" binding:"required"`
	EndTime    string `json:"end_time" binding:"required"`
}

type Owner

type Owner struct {
	ID        string
	Mail      string
	Name      string
	Surname   string
	Companies map[string]struct{}
}

func GetOwner

func GetOwner(c *gin.Context) (Owner, error)

type Service

type Service struct {
	Name        *string `json:"name" binding:"omitempty,max=30"`
	Price       *int32  `json:"price" binding:"omitempty,min=0,max=1000000"`
	Duration    *int32  `json:"duration" binding:"omitempty,min=0,max=480"`
	Description *string `json:"description" binding:"omitempty,max=300"`
}

type User

type User struct {
	Mail     string  `json:"mail" binding:"required,max=30"`
	PlainPwd string  `json:"pwd" bidning:"required,max=72"`
	Name     *string `json:"name" binding:"omitempty,max=30"`
	Surname  *string `json:"surname" binding:"omitempty,max=30"`
}

type UserUpdate

type UserUpdate struct {
	Mail     *string `json:"mail" binding:"omitempty,max=30"`
	PlainPwd *string `json:"pwd" bidning:"omitempty,max=72"`
	Name     *string `json:"name" binding:"omitempty,max=30"`
	Surname  *string `json:"surname" binding:"omitempty,max=30"`
}

Jump to

Keyboard shortcuts

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