Documentation
¶
Index ¶
- type APICommonQueryID
- type APICommonQuerySearch
- type APICommonQueryUUID
- type AddressOrderResponse
- type AddressResponse
- type AddressResponseDetail
- type AreaResponse
- type CartCheck
- type CartInsert
- type CartItemResponse
- type CategoryCreate
- type CategoryResponse
- type CategoryResponseCompact
- type CategoryUpdate
- type ChangePassword
- type CheckAll
- type CheckoutItem
- type CheckoutItemInternal
- type CheckoutRequest
- type CreateAddress
- type CreateReview
- type CustomerAuth
- type CustomerProfile
- type GetBanner
- type GetRatesByProductRequest
- type HomepageProduct
- type HomepageProductResponse
- type InsertBanner
- type ItemListOrderDetail
- type ListStaff
- type NewStaff
- type OrderDetailResponse
- type OrderResponse
- type OrderResponseStaff
- type PreCheckoutFreight
- type PreCheckoutFreightItems
- type PreCheckoutItem
- type ProductCreate
- type ProductDetail
- type ProductImage
- type ProductImageDelete
- type ProductUpdate
- type ReqEmailVerification
- type ReqEmailVerificationConfirmation
- type ReqLoginCustomer
- type ReqLoginStaff
- type ReqNewAccount
- type ReviewResponseCustomer
- type ReviewResponseGlobal
- type ShipOrderToCustomer
- type StaffAuth
- type UpdateAddress
- type UpdateStaff
- type WishlistItemResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICommonQueryID ¶
type APICommonQueryID struct {
ID int `form:"id" binding:"required"`
}
type APICommonQuerySearch ¶
type APICommonQuerySearch struct {
Search string `form:"search" binding:"required"`
}
type APICommonQueryUUID ¶
type APICommonQueryUUID struct {
ID string `form:"id" binding:"required,uuid"`
}
type AddressOrderResponse ¶
type AddressOrderResponse struct {
RecipientName string `json:"recipient_name"`
PhoneNumber string `json:"phone_number"`
FullAddress string `json:"full_address"`
ShippingArea string `json:"shipping_area"`
}
AddressOrderResponse is a specific struct for order detail response
type AddressResponse ¶
type AddressResponseDetail ¶
type AddressResponseDetail struct {
ID string `json:"id"`
Label string `json:"label"`
FullAddress string `json:"full_address"`
Note string `json:"note"`
RecipientName string `json:"recipient_name"`
PhoneNumber string `json:"phone_number"`
ShippingArea string `json:"shipping_area"`
AreaID uint32 `json:"area_id"`
PostalCode string `json:"postal_code"`
}
type AreaResponse ¶
type CartCheck ¶
type CartCheck struct {
ProductID string `json:"id" binding:"required,uuid"`
State *bool `json:"state" binding:"required"`
}
CartCheck is used to tick or un-tick a product in cart (to be purchased)
type CartInsert ¶
type CartItemResponse ¶
type CategoryCreate ¶
type CategoryResponse ¶
type CategoryResponseCompact ¶
type CategoryUpdate ¶
type ChangePassword ¶
type ChangePassword struct {
OldPassword string `json:"old_password" binding:"required"`
NewPassword string `json:"new_password" binding:"required"`
}
func (*ChangePassword) CheckPassword ¶
func (s *ChangePassword) CheckPassword(password string) bool
func (*ChangePassword) HashPassword ¶
func (s *ChangePassword) HashPassword() error
func (*ChangePassword) PasswordIsValid ¶
func (s *ChangePassword) PasswordIsValid() bool
type CheckoutItem ¶
type CheckoutItem struct {
Id string `json:"id"`
Name string `json:"name"`
Price int `json:"price"`
Quantity int `json:"quantity"`
}
CheckoutItem is used to store the product information to be purchased into midtrans API
type CheckoutItemInternal ¶
type CheckoutItemInternal struct {
CheckoutItem
Description string `json:"description"`
Weight float64 `json:"weight"`
}
CheckoutItemInternal is used to store the product information that also need to put in the db
type CheckoutRequest ¶
type CreateAddress ¶
type CreateAddress struct {
Label string `json:"label" binding:"required"`
FullAddress string `json:"full_address" binding:"required"`
Note string `json:"note"`
RecipientName string `json:"recipient_name" binding:"required"`
PhoneNumber string `json:"phone_number" binding:"required"`
ShippingArea uint32 `json:"shipping_area" binding:"required"`
PostalCode string `json:"postal_code" binding:"required"`
}
type CreateReview ¶
type CustomerAuth ¶
type CustomerAuth struct {
ID uuid.UUID
HashedPassword string
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
}
func (*CustomerAuth) CheckPassword ¶
func (s *CustomerAuth) CheckPassword(password string) bool
type CustomerProfile ¶
type HomepageProduct ¶
type HomepageProduct struct {
ID string `json:"id"`
Name string `json:"name"`
Price uint `json:"price"`
ImageUrl string `json:"image"`
Rating float64 `json:"rating"`
Sold uint `json:"sold"`
}
HomepageProduct is the sub model for HomepageProductResponse, and it also used for the product search response
type HomepageProductResponse ¶
type HomepageProductResponse struct {
CategoryID uint `json:"category_id"`
CategoryName string `json:"category_name"`
CategoryDesc string `json:"category_desc"`
Products []HomepageProduct `json:"products"`
}
HomepageProductResponse is the model for the homepage product response
type InsertBanner ¶
type InsertBanner struct {
Picture *multipart.FileHeader `form:"picture" binding:"required"`
Href string `form:"href" binding:"required"`
}
type ItemListOrderDetail ¶
type ItemListOrderDetail struct {
OrderID uint64 `json:"order_id"`
PreCheckoutItem
Reviewed bool `json:"reviewed"`
}
type NewStaff ¶
type NewStaff struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
Name string `json:"name" binding:"required"`
FinUser bool `json:"fin_user"`
InvUser bool `json:"inv_user"`
SysAdmin bool `json:"sys_admin"`
}
func (*NewStaff) HashPassword ¶
func (*NewStaff) PasswordIsValid ¶
type OrderDetailResponse ¶
type OrderDetailResponse struct {
ID uint64 `json:"id"`
Status string `json:"status"`
StatusDescription string `json:"status_description"`
PaymentType string `json:"payment_type"`
PaymentUrl string `json:"payment_url,omitempty"`
CreatedAt string `json:"created_at"`
ItemList []ItemListOrderDetail `json:"item_list"`
Courier string `json:"courier"`
TrackingCode string `json:"tracking_code"`
AddressDetail AddressOrderResponse `json:"address_detail"`
ItemCost uint `json:"item_cost"`
ShippingCost uint `json:"shipping_cost"`
TotalCost uint `json:"total_cost"`
}
type OrderResponse ¶
type OrderResponseStaff ¶
type OrderResponseStaff struct {
OrderResponse
Shipped bool `json:"shipped"`
Paid bool `json:"paid,omitempty"`
NeedRefund bool `json:"need_refund,omitempty"`
}
type PreCheckoutFreight ¶
type PreCheckoutFreightItems ¶
type PreCheckoutItem ¶
type ProductCreate ¶
type ProductCreate struct {
CategoryID uint `json:"category_id" binding:"required"`
Name string `json:"name" binding:"required"`
Description string `json:"description" binding:"required"`
Price uint `json:"price" binding:"required"`
Weight float64 `json:"weight" binding:"required"`
InitialStock uint `json:"initial_stock" binding:"required"`
Length uint16 `json:"length" binding:"required"`
Width uint16 `json:"width" binding:"required"`
Height uint16 `json:"height" binding:"required"`
}
ProductCreate is the model for creating a new product on step 1
type ProductDetail ¶
type ProductDetail struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Price uint `json:"price"`
Weight float64 `json:"weight"`
CategoryName string `json:"category_name"`
CumulativeReview float64 `json:"cumulative_review"`
ImageUrls []string `json:"image_urls"`
Dimension string `json:"dimension"`
Stock uint `json:"stock"`
}
ProductDetail is the model for product detail response (query by id)
type ProductImage ¶
type ProductImage struct {
ProductID string `form:"product_id" binding:"required,uuid"`
Picture *multipart.FileHeader `form:"picture" binding:"required"`
}
type ProductImageDelete ¶
type ProductUpdate ¶
type ProductUpdate struct {
ID string `json:"id" binding:"required,uuid"`
CategoryID uint `json:"category_id"`
Name string `json:"name"`
Description string `json:"description"`
Price uint `json:"price"`
Weight float64 `json:"weight"`
Stock uint `json:"stock"`
Length uint16 `json:"length"`
Width uint16 `json:"width"`
Height uint16 `json:"height"`
}
ProductUpdate is the model for updating a product (also considered as step 1) there is no product update for step 2 (product images)
type ReqEmailVerification ¶
type ReqEmailVerification struct {
Email string `json:"email" binding:"required"`
}
type ReqLoginCustomer ¶
type ReqLoginStaff ¶
type ReqNewAccount ¶
type ReqNewAccount struct {
Email string `json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
FirstName string `json:"first_name" binding:"required"`
LastName string `json:"last_name" binding:"required"`
BirthDate time.Time `json:"birth_date" binding:"required"`
Gender string `json:"gender" binding:"required"`
}
ReqNewAccount happen after user has verified their email
func (*ReqNewAccount) HashPassword ¶
func (s *ReqNewAccount) HashPassword() error
func (*ReqNewAccount) PasswordIsValid ¶
func (s *ReqNewAccount) PasswordIsValid() bool
PasswordIsValid validate password is at least 8 characters long and contains at least one uppercase letter, one lowercase letter, and one number
type ReviewResponseCustomer ¶
type ReviewResponseCustomer struct {
ID string `json:"id"`
ProductID string `json:"product_id"`
ProductName string `json:"product_name"`
ProductImage string `json:"product_image"`
Rating uint8 `json:"rating"`
Review string `json:"review"`
CreatedAt string `json:"created_at"`
}
ReviewResponseCustomer is a specific struct for review response in customer page
type ReviewResponseGlobal ¶
type ShipOrderToCustomer ¶
type StaffAuth ¶
type StaffAuth struct {
ID uint `json:"id"`
Username string `json:"username"`
HashedPassword string
FinUser bool `json:"fin_user"`
InvUser bool `json:"inv_user"`
SysAdmin bool `json:"sys_admin"`
}
func (*StaffAuth) CheckPassword ¶
type UpdateAddress ¶
type UpdateAddress struct {
ID string `json:"id" binding:"required"`
Label string `json:"label"`
FullAddress string `json:"full_address"`
Note string `json:"note"`
RecipientName string `json:"recipient_name"`
PhoneNumber string `json:"phone_number"`
ShippingArea uint32 `json:"shipping_area"`
PostalCode string `json:"postal_code"`
}
type UpdateStaff ¶
type UpdateStaff struct {
ID uint `json:"id" binding:"required"`
Password string `json:"password"`
Name string `json:"name"`
FinUser *bool `json:"fin_user" binding:"required"`
InvUser *bool `json:"inv_user" binding:"required"`
SysAdmin *bool `json:"sys_admin" binding:"required"`
}
func (*UpdateStaff) HashPassword ¶
func (s *UpdateStaff) HashPassword() error
func (*UpdateStaff) PasswordIsValid ¶
func (s *UpdateStaff) PasswordIsValid() bool