entity

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnualIncome

type AnnualIncome struct {
	Year   int    `json:"year"`
	Month  string `json:"month"`
	Income int    `json:"income"`
}

type CreateOrderItemParam

type CreateOrderItemParam struct {
	ProductID int64 `json:"product_id" validate:"required"`
	Quantity  int   `json:"quantity" validate:"required"`
	Subtotal  int   `json:"subtotal,omitempty"`
	OrderId   int64
}

type CreateOrderParam

type CreateOrderParam struct {
	Total int                     `json:"total,omitempty"`
	Items []*CreateOrderItemParam `json:"order_items" validate:"required"`
}

type CreateProductParam

type CreateProductParam struct {
	Code  string `json:"code" form:"code" validate:"required"`
	Name  string `json:"name" form:"name" validate:"required"`
	Price int    `json:"price" form:"price" validate:"required,numeric,gt=0"`
	Stock int    `json:"stock" form:"stock" validate:"required,numeric,gte=0"`
}

type ErrInvalidCredential

type ErrInvalidCredential struct {
	Message string
	Err     error
}

func (ErrInvalidCredential) Error

func (eic ErrInvalidCredential) Error() string

type ErrItemAlreadyExists

type ErrItemAlreadyExists struct {
	Message string
	Err     error
}

func (ErrItemAlreadyExists) Error

func (eie ErrItemAlreadyExists) Error() string

type ErrNotFound

type ErrNotFound struct {
	Message string
	Err     error
}

func (ErrNotFound) Error

func (ent ErrNotFound) Error() string

type ErrValidation

type ErrValidation struct {
	Message string
	Errors  map[string]string
}

func (ErrValidation) Error

func (ve ErrValidation) Error() string

type Order

type Order struct {
	ID        int64        `json:"id,omitempty"`
	Total     int          `json:"total"`
	CreatedAt time.Time    `json:"created_at,omitempty"`
	Items     []*OrderItem `json:"order_items"`
}

type OrderItem

type OrderItem struct {
	ID           int64     `json:"id,omitempty"`
	OrderID      int64     `json:"order_id,omitempty"`
	ProductID    int64     `json:"product_id"`
	ProductCode  string    `json:"product_code"`
	ProductName  string    `json:"product_name"`
	ProductPrice int       `json:"product_price"`
	Quantity     int       `json:"quantity"`
	Subtotal     int       `json:"subtotal"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
}

type Product

type Product struct {
	ID        int64     `json:"id"`
	Code      string    `json:"code"`
	Name      string    `json:"name"`
	Price     int       `json:"price"`
	Stock     int       `json:"stock"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type ProductSale

type ProductSale struct {
	ID   int64  `json:"id"`
	Code string `json:"code"`
	Name string `json:"name"`
	Sale int    `json:"sale"`
}

type UpdateProductParam

type UpdateProductParam struct {
	Code  string `form:"code"`
	Name  string `form:"name"`
	Price int    `form:"price" validate:"numeric,gt=0"`
	Stock int    `form:"stock" validate:"numeric,gte=0"`
}

type UpdateUserParam

type UpdateUserParam struct {
	Name     string  `db:"name" validate:"required"`
	Email    string  `db:"email" validate:"required,email"`
	PhotoUrl *string `db:"omitempty,photo_url"`
}

type UpdateUserPasswordParam

type UpdateUserPasswordParam struct {
	Password             string `db:"password" form:"password" validate:"required"`
	PasswordConfirmation string `form:"password_confirmation" validate:"required,eqfield=Password"`
}

type User

type User struct {
	ID        int64
	Name      string `form:"name"`
	Email     string `form:"email"`
	PhotoUrl  *string
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type UserCredential

type UserCredential struct {
	Email    string `form:"email" validate:"required,email"`
	Password string `form:"password" validate:"required"`
}

Jump to

Keyboard shortcuts

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