Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInternal is an error for when an internal service fails to process the request ErrInternal = errors.New("internal error") // ErrDataNotFound is an error for when requested data is not found ErrDataNotFound = errors.New("data not found") // ErrNoUpdatedData is an error for when no data is provided to update ErrNoUpdatedData = errors.New("no data to update") // ErrConflictingData is an error for when data conflicts with existing data ErrConflictingData = errors.New("data conflicts with existing data in unique column") // ErrInsufficientStock is an error for when product stock is not enough ErrInsufficientStock = errors.New("product stock is not enough") // ErrInsufficientPayment is an error for when total paid is less than total price ErrInsufficientPayment = errors.New("total paid is less than total price") // ErrTokenDuration is an error for when the token duration format is invalid ErrTokenDuration = errors.New("invalid token duration format") // ErrTokenCreation is an error for when the token creation fails ErrTokenCreation = errors.New("error creating token") // ErrExpiredToken is an error for when the access token is expired ErrExpiredToken = errors.New("access token has expired") // ErrInvalidToken is an error for when the access token is invalid ErrInvalidToken = errors.New("access token is invalid") // ErrInvalidCredentials is an error for when the credentials are invalid ErrInvalidCredentials = errors.New("invalid email or password") // ErrEmptyAuthorizationHeader is an error for when the authorization header is empty ErrEmptyAuthorizationHeader = errors.New("authorization header is not provided") // ErrInvalidAuthorizationHeader is an error for when the authorization header is invalid ErrInvalidAuthorizationHeader = errors.New("authorization header format is invalid") // ErrInvalidAuthorizationType is an error for when the authorization type is invalid ErrInvalidAuthorizationType = errors.New("authorization type is not supported") ErrUnauthorized = errors.New("user is unauthorized to access the resource") // ErrForbidden is an error for when the user is forbidden to access the resource ErrForbidden = errors.New("user is forbidden to access the resource") )
Functions ¶
This section is empty.
Types ¶
type Order ¶
type Order struct { ID uint64 UserID uint64 PaymentID uint64 CustomerName string TotalPrice float64 TotalPaid float64 TotalReturn float64 ReceiptCode uuid.UUID CreatedAt time.Time UpdatedAt time.Time User *User Payment *Payment Products []OrderProduct }
Order is an entity that represents an order
type OrderProduct ¶
type OrderProduct struct { ID uint64 OrderID uint64 ProductID uint64 Quantity int64 TotalPrice float64 CreatedAt time.Time UpdatedAt time.Time Order *Order Product *Product }
OrderProduct is an entity that represents pivot table between order and product
type Payment ¶
type Payment struct { ID uint64 Name string Type PaymentType Logo string CreatedAt time.Time UpdatedAt time.Time }
Payment is an entity that represents a payment
type PaymentType ¶
type PaymentType string
PaymentType is an enum for payment's type
const ( Cash PaymentType = "CASH" EWallet PaymentType = "E-WALLET" EDC PaymentType = "EDC" )
PaymentType enum values
type Product ¶
type Product struct { ID uint64 CategoryID uint64 SKU uuid.UUID Name string Stock int64 Price float64 Image string CreatedAt time.Time UpdatedAt time.Time Category *Category }
Product is an entity that represents a product
type TokenPayload ¶
TokenPayload is an entity that represents the payload of the token
Click to show internal directories.
Click to hide internal directories.