Documentation ¶
Index ¶
Constants ¶
View Source
const ( CreateUserSuccess = "user created successfully" VerifyEmailSuccess = "email verified successfully" SignInSuccess = "sign in successfully" )
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 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 SignInRequest ¶
type SignInResponse ¶
type SignInResponse struct {
Token string `json:"token" validate:"required"`
}
type SignUpRequest ¶
type SignUpResponse ¶
Click to show internal directories.
Click to hide internal directories.