dto

package
v0.0.0-...-9eb387d Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateUserSuccess  = "user created successfully"
	VerifyEmailSuccess = "email verified successfully"
	SignInSuccess      = "sign in successfully"

	Unauthorized = "You are not authorized to access this resource"
)
View Source
const (
	CreateProductSuccess      = "Product created successfully"
	UploadProductPhotoSuccess = "Product photo uploaded successfully"
	SearchProductSuccess      = "Product search success"
	DetailProductSuccess      = "Find product detail success"
	CatalogProductSuccess     = "Find product catalog success"

	FileSizeExceeded = "File size exceeded, not more than 2MB"

	ProductPhotoURL = "https://storage.googleapis.com/backend1-bucket/products/"
)
View Source
const (
	// StatusSuccess is a constant for success status
	StatusSuccess = "success"
	// StatusError is a constant for error status
	StatusError = "error"
)

Variables

View Source
var (
	ErrFindUserFailed      = errors.New("error when find user by email")
	ErrFindUserNotFound    = errors.New("user not found")
	ErrUserAlreadyExists   = errors.New("user already exists")
	ErrCreateUserFailed    = errors.New("failed to create user")
	ErrUpdateUserFailed    = errors.New("failed to update user")
	ErrInvalidCode         = errors.New("invalid verification code")
	ErrPasswordNotMatch    = errors.New("password not match")
	ErrUserNotVerified     = errors.New("user not verified")
	ErrGenerateTokenFailed = errors.New("failed to generate jwt token")
)

Functions

This section is empty.

Types

type CreateProductRequest

type CreateProductRequest struct {
	Name       string  `json:"name" validate:"required"`
	Detail     string  `json:"detail" validate:"required"`
	Price      float64 `json:"price" validate:"required"`
	Stock      uint    `json:"stock" validate:"required"`
	CategoryID uint    `json:"category_id" validate:"required,gte=1"`
}

type CreateProductResponse

type CreateProductResponse struct {
	ID uint `json:"id" validate:"required"`
}

type ProductDetailResponse

type ProductDetailResponse struct {
	ID           uint    `json:"id" validate:"required"`
	Stock        uint    `json:"stock" validate:"gte=0"`
	Sold         uint    `json:"sold" validate:"gte=0"`
	AmountRating uint    `json:"amount_rating" validate:"gte=0"`
	Name         string  `json:"name" validate:"required"`
	Detail       string  `json:"detail" validate:"required"`
	Photo        string  `json:"photo" validate:"required"`
	Rating       float32 `json:"rating" validate:"gte=0,lte=5"`
	Price        float64 `json:"price" validate:"required"`
}

type ProductOverviewResponse

type ProductOverviewResponse struct {
	ID     uint    `json:"id" validate:"required"`
	Stock  uint    `json:"stock" validate:"gte=0"`
	Sold   uint    `json:"sold" validate:"gte=0"`
	Name   string  `json:"name" validate:"required"`
	Photo  string  `json:"photo" validate:"required"`
	Rating float32 `json:"rating" validate:"gte=0,lte=5"`
	Price  float64 `json:"price" validate:"required"`
}

type ProductsResponse

type ProductsResponse struct {
	RecommendedProducts []ProductOverviewResponse `json:"products_history" validate:"required"`
	Products            []ProductOverviewResponse `json:"products" validate:"required"`
}

type Response

type Response struct {
	Message string      `json:"message"`
	Status  string      `json:"status"`
	Data    interface{} `json:"data,omitempty"`
}

type SignInRequest

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

type SignInResponse

type SignInResponse struct {
	Token string `json:"token" validate:"required"`
}

type SignUpRequest

type SignUpRequest struct {
	Name     string `json:"name" validate:"required"`
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,password"`
}

type SignUpResponse

type SignUpResponse struct {
	ID           uint   `json:"id" validate:"required"`
	Email        string `json:"email" validate:"required,email"`
	Verification string `json:"verification" validate:"required"`
}

Jump to

Keyboard shortcuts

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