models

package
v0.0.0-...-3b2859e Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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 AddressResponse 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"`
}

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 AreaResponse struct {
	ID   uint32 `json:"id"`
	Name string `json:"name"`
}

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 CartInsert struct {
	ProductId string `json:"id" binding:"required,uuid"`
	Quantity  uint16 `json:"quantity" binding:"required"`
}

type CartItemResponse

type CartItemResponse struct {
	ProductId    string `json:"id"`
	ProductName  string `json:"name"`
	ProductPrice uint   `json:"price"`
	ProductImage string `json:"image"`
	Quantity     uint16 `json:"quantity"`
	CurrentStock uint16 `json:"curr_stock"`
	Checked      bool   `json:"checked"`
}

type CategoryCreate

type CategoryCreate struct {
	Name               string `json:"name" binding:"required"`
	Description        string `json:"description" binding:"required"`
	HomePageVisibility *bool  `json:"homepage_visibility" binding:"required"`
}

type CategoryResponse

type CategoryResponse struct {
	ID                 uint   `json:"id"`
	Name               string `json:"name"`
	Description        string `json:"description"`
	HomePageVisibility bool   `json:"homepage_visibility"`
}

type CategoryResponseCompact

type CategoryResponseCompact struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type CategoryUpdate

type CategoryUpdate struct {
	ID                 uint   `json:"id" binding:"required"`
	Name               string `json:"name"`
	Description        string `json:"description"`
	HomePageVisibility *bool  `json:"homepage_visibility"`
}

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 CheckAll

type CheckAll struct {
	State *bool `json:"state" binding:"required"`
}

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 CheckoutRequest struct {
	CourierCode string `json:"courier_code" binding:"required"`
	AddressCode string `json:"address_code" binding:"required,uuid"`
}

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 CreateReview struct {
	OrderID uint64 `json:"order_id" binding:"required"`
	Rating  uint8  `json:"rating" binding:"required"`
	Review  string `json:"review"`
}

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 CustomerProfile struct {
	Email       string    `json:"email"`
	PhoneNumber string    `json:"phone_number"`
	FirstName   string    `json:"first_name"`
	LastName    string    `json:"last_name"`
	BirthDate   time.Time `json:"birth_date"`
	Gender      string    `json:"gender"`
}

type GetBanner

type GetBanner struct {
	Id       uint   `json:"id"`
	ImageUrl string `json:"image_url"`
	Href     string `json:"href"`
}

type GetRatesByProductRequest

type GetRatesByProductRequest struct {
	ProductID string `form:"product_id" binding:"uuid"`
	AreaID    uint32 `form:"area_id" binding:"required"`
}

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 ListStaff

type ListStaff struct {
	ID       uint   `json:"id"`
	Username string `json:"username"`
	Name     string `json:"name"`
	FinUser  bool   `json:"fin_user"`
	InvUser  bool   `json:"inv_user"`
	SysAdmin bool   `json:"sys_admin"`
}

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 (s *NewStaff) HashPassword() error

func (*NewStaff) PasswordIsValid

func (s *NewStaff) PasswordIsValid() bool

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 OrderResponse struct {
	ID          uint64 `json:"id"`
	CreatedAt   string `json:"created_at"`
	GrossAmount uint   `json:"gross_amount"`
	Status      string `json:"status"`
	ItemCount   uint8  `json:"item_count"`
	Image       string `json:"image"`
	ProductName string `json:"product_name"`
	Reviewed    bool   `json:"reviewed"`
}

type OrderResponseStaff

type OrderResponseStaff struct {
	OrderResponse
	Shipped    bool `json:"shipped"`
	Paid       bool `json:"paid,omitempty"`
	NeedRefund bool `json:"need_refund,omitempty"`
}

type PreCheckoutFreight

type PreCheckoutFreight struct {
	ProductCode string `json:"product_code"`
	CourierName string `json:"courier_name"`
	ProductName string `json:"product_name"`
	Etd         string `json:"etd"`
	Rates       int    `json:"rates"`
}

type PreCheckoutFreightItems

type PreCheckoutFreightItems struct {
	Weight float64 `json:"weight"`
	Volume float64 `json:"volume"`
}

type PreCheckoutItem

type PreCheckoutItem struct {
	ProductId    string `json:"id"`
	ProductName  string `json:"name"`
	ProductPrice uint   `json:"price"`
	ProductImage string `json:"image"`
	Quantity     uint16 `json:"quantity"`
}

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 ProductImageDelete struct {
	ProductID string `json:"product_id" binding:"required,uuid"`
	FileName  string `json:"file_name" binding:"required"`
}

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 ReqEmailVerificationConfirmation

type ReqEmailVerificationConfirmation struct {
	Email string `json:"email" binding:"required"`
	Code  int    `json:"code" binding:"required"`
}

type ReqLoginCustomer

type ReqLoginCustomer struct {
	Email      string `json:"email" binding:"required"`
	Password   string `json:"password" binding:"required"`
	RememberMe bool   `json:"remember_me"`
}

type ReqLoginStaff

type ReqLoginStaff struct {
	Username   string `json:"username" binding:"required"`
	Password   string `json:"password" binding:"required"`
	RememberMe bool   `json:"remember_me"`
}

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 ReviewResponseGlobal struct {
	ID        string `json:"id"`
	Rating    uint8  `json:"rating"`
	Review    string `json:"review"`
	CreatedAt string `json:"created_at"`
	Customer  string `json:"customer"`
}

type ShipOrderToCustomer

type ShipOrderToCustomer struct {
	OrderId      uint64 `json:"order_id" binding:"required"`
	TrackingCode string `json:"tracking_code" binding:"required"`
}

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

func (s *StaffAuth) CheckPassword(password string) bool

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

type WishlistItemResponse

type WishlistItemResponse 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"`
}

Jump to

Keyboard shortcuts

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