update
This commit is contained in:
@@ -13,6 +13,13 @@ type JWTAuthClaims struct {
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
type JWTAuthClaimsCustomer struct {
|
||||
UserID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
type JWTOrderClaims struct {
|
||||
PartnerID int64 `json:"id"`
|
||||
OrderID int64 `json:"order_id"`
|
||||
|
||||
+16
-14
@@ -75,18 +75,19 @@ func (Order) TableName() string {
|
||||
}
|
||||
|
||||
type OrderItem struct {
|
||||
ID int64 `gorm:"primaryKey;autoIncrement;column:order_item_id"`
|
||||
OrderID int64 `gorm:"type:int;column:order_id"`
|
||||
ItemID int64 `gorm:"type:int;column:item_id"`
|
||||
ItemType string `gorm:"type:varchar;column:item_type"`
|
||||
Price float64 `gorm:"type:numeric;not null;column:price"`
|
||||
Quantity int `gorm:"type:int;column:quantity"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
|
||||
CreatedBy int64 `gorm:"type:int;column:created_by"`
|
||||
UpdatedBy int64 `gorm:"type:int;column:updated_by"`
|
||||
Product *Product `gorm:"foreignKey:ItemID;references:ID"`
|
||||
ItemName string `gorm:"type:varchar;column:item_name"`
|
||||
ID int64 `gorm:"primaryKey;autoIncrement;column:order_item_id"`
|
||||
OrderID int64 `gorm:"type:int;column:order_id"`
|
||||
ItemID int64 `gorm:"type:int;column:item_id"`
|
||||
ItemType string `gorm:"type:varchar;column:item_type"`
|
||||
Price float64 `gorm:"type:numeric;not null;column:price"`
|
||||
Quantity int `gorm:"type:int;column:quantity"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
|
||||
CreatedBy int64 `gorm:"type:int;column:created_by"`
|
||||
UpdatedBy int64 `gorm:"type:int;column:updated_by"`
|
||||
Product *Product `gorm:"foreignKey:ItemID;references:ID"`
|
||||
ItemName string `gorm:"type:varchar;column:item_name"`
|
||||
Description string `gorm:"type:varchar;column:description"`
|
||||
}
|
||||
|
||||
func (OrderItem) TableName() string {
|
||||
@@ -110,8 +111,9 @@ type OrderRequest struct {
|
||||
}
|
||||
|
||||
type OrderItemRequest struct {
|
||||
ProductID int64 `json:"product_id" validate:"required"`
|
||||
Quantity int `json:"quantity" validate:"required"`
|
||||
ProductID int64 `json:"product_id" validate:"required"`
|
||||
Quantity int `json:"quantity" validate:"required"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type OrderExecuteRequest struct {
|
||||
|
||||
@@ -30,6 +30,7 @@ type ProductSearch struct {
|
||||
Name string
|
||||
Type product.ProductType
|
||||
BranchID int64
|
||||
PartnerID int64
|
||||
Available product.ProductStock
|
||||
Limit int
|
||||
Offset int
|
||||
|
||||
@@ -125,3 +125,12 @@ func (c Customer) HashedPassword() string {
|
||||
|
||||
return string(hashedPassword)
|
||||
}
|
||||
|
||||
func (u *Customer) ToUserAuthenticate(signedToken string) *AuthenticateUser {
|
||||
return &AuthenticateUser{
|
||||
ID: u.ID,
|
||||
Token: signedToken,
|
||||
Name: u.Name,
|
||||
UserType: u.UserType,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user