dto

package
v0.0.0-...-afa0789 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizedUser

type AuthorizedUser struct {
	UserID     string
	Privileges []string
}

func GetAuthorizedUser

func GetAuthorizedUser(ctx context.Context) AuthorizedUser

type CreateParam

type CreateParam[T any] struct {
	CreateValue T
	Session     AuthorizedUser
}

type DetailParam

type DetailParam struct {
	ID      string
	Session AuthorizedUser
}

type EntitySnapshot

type EntitySnapshot struct {
	Snapshot datatypes.JSON
}

type FilterCommonParams

type FilterCommonParams struct {
	Keyword  string
	Name     string
	IsActive *bool
	MemberId string
	IsDone   *bool
}

type FilterOrderParams

type FilterOrderParams struct {
	RequestAt []int64
	OrderType int
	GoodId    string
}

type GoodCreateRequest

type GoodCreateRequest struct {
	Code        string `json:"code" validate:"min=1,max=10,required"`
	Name        string `json:"name" validate:"min=1,max=20,required"`
	Description string `json:"description" validate:"required"`
}

func (*GoodCreateRequest) Bind

func (t *GoodCreateRequest) Bind(r *http.Request) error

type GoodOrderRequest

type GoodOrderRequest struct {
	Code string `json:"code" validate:"min=1,max=10,required"`
}

type GoodOrderResponse

type GoodOrderResponse struct {
	Code string `json:"code"`
}

type GoodResponse

type GoodResponse struct {
	ID                string            `json:"id"`
	Code              string            `json:"code"`
	Name              string            `json:"name"`
	Description       string            `json:"description"`
	IsActive          bool              `json:"is_active"`
	GoodStockResponse GoodStockResponse `json:"stock"`
	Timestamp
}

type GoodSnapShot

type GoodSnapShot struct {
	ID                string            `json:"id"`
	Code              string            `json:"code"`
	Name              string            `json:"name"`
	Description       string            `json:"description"`
	IsActive          bool              `json:"is_active"`
	GoodStockSnapshot GoodStockSnapshot `json:"stock"`
	Timestamp
}

type GoodStockRequest

type GoodStockRequest struct {
	Total int
}

type GoodStockResponse

type GoodStockResponse struct {
	Total int `json:"total"`
}

type GoodStockSnapshot

type GoodStockSnapshot struct {
	Total int `json:"total"`
}

type GoodUpdateRequest

type GoodUpdateRequest struct {
	Code        string `json:"code" validate:"min=1,max=10,required"`
	Name        string `json:"name" validate:"min=1,max=20,required"`
	Description string `json:"description" validate:"required"`
	IsActive    bool   `json:"is_active" validate:"boolean"`
}

func (*GoodUpdateRequest) Bind

func (t *GoodUpdateRequest) Bind(r *http.Request) error

type ListParam

type ListParam[T any] struct {
	Filters    T
	Orders     string
	Pagination Pagination
	Session    AuthorizedUser
}

list param

type ListResponse

type ListResponse[T any] struct {
	Rows     []T        `json:"rows"`
	MetaData Pagination `json:"metadata"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" validate:"required,email,normalize"`
	Password string `json:"password" validate:"required"`
}

func (*LoginRequest) Bind

func (l *LoginRequest) Bind(r *http.Request) error

type LoginResponse

type LoginResponse struct {
	AccessToken  string       `json:"access_token"`
	RefreshToken string       `json:"refresh_token"`
	UserResponse UserResponse `json:"user"`
}

type OrderCreateMultipleRequest

type OrderCreateMultipleRequest struct {
	Items []OrderItem `json:"items" validate:"required,unique"`
	Type  enum.OrderType
}

func (*OrderCreateMultipleRequest) Bind

Bind implements render.Binder.

type OrderCreateMultipleResponse

type OrderCreateMultipleResponse struct {
	ID      string                      `json:"id"`
	Success []OrderItemMultipleResponse `json:"success"`
	Failed  []OrderItemMultipleResponse `json:"failed"`
	Timestamp
}

type OrderInRequest

type OrderInRequest struct {
	Good  GoodOrderRequest `json:"good"`
	Total int              `json:"total" validate:"min=1,number,required"`
}

func (*OrderInRequest) Bind

func (t *OrderInRequest) Bind(r *http.Request) error

type OrderItem

type OrderItem struct {
	Code  string `json:"code" validate:"min=1,max=10,required"`
	Total int    `json:"total" validate:"min=1,number,required"`
}

type OrderItemMultipleResponse

type OrderItemMultipleResponse struct {
	Code   string `json:"code"`
	Total  int    `json:"total"`
	Reason string `json:"reason"`
}

type OrderItemResponse

type OrderItemResponse struct {
	ID                   string       `json:"id"`
	GoodSnapshotResponse GoodResponse `json:"good_snapshot"`
	Total                int          `json:"total"`
	Timestamp
}

type OrderItemTemp

type OrderItemTemp struct {
	Code   string
	GoodID string
	Total  int
	Reason error
}

type OrderResponse

type OrderResponse struct {
	ID                   string              `json:"id"`
	RequestAt            int64               `json:"request_at"`
	Type                 OrderTypeResponse   `json:"type"`
	GoodSnapshotResponse *GoodResponse       `json:"good_snapshot"`
	Total                int                 `json:"total"`
	CountItem            int                 `json:"count_item"`
	Items                []OrderItemResponse `json:"items"`
	Timestamp
}

type OrderTypeResponse

type OrderTypeResponse struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Pagination

type Pagination struct {
	Page       int   `json:"page"`
	Limit      int   `json:"limit"`
	TotalPages int   `json:"total_pages"`
	TotalItems int64 `json:"total_items"`
	Offset     int   `json:",omitempty"`
}

type RegisterRequest

type RegisterRequest struct {
	FullName string `json:"full_name" validate:"required"`
	Email    string `json:"email" validate:"email,normalize"`
	Password string `json:"password" validate:"required"`
}

func (*RegisterRequest) Bind

func (rr *RegisterRequest) Bind(r *http.Request) error

type SelectAndCount

type SelectAndCount[M any] struct {
	Rows  []*M
	Count int64
}

type Timestamp

type Timestamp struct {
	CreatedAt int64 `json:"created_at"`
	UpdatedAt int64 `json:"updated_at"`
}

func ComposeTimestamp

func ComposeTimestamp(m model.TimestampColumn) Timestamp

type UpdateParam

type UpdateParam[T any] struct {
	ID          string
	UpdateValue T
	Session     AuthorizedUser
}

update param

type UserResponse

type UserResponse struct {
	ID       string `json:"id"`
	FullName string `json:"full_name"`
	Email    string `json:"email"`
	Timestamp
}

Jump to

Keyboard shortcuts

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