Add User Partner and Product
This commit is contained in:
+20
-25
@@ -6,20 +6,25 @@ import (
|
||||
)
|
||||
|
||||
type Product struct {
|
||||
ID int64
|
||||
Name string
|
||||
Type product.ProductType
|
||||
Price float64
|
||||
Status product.ProductStatus
|
||||
Description string
|
||||
Image string
|
||||
BranchID int64
|
||||
StockQty int64
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time
|
||||
CreatedBy int64
|
||||
UpdatedBy int64
|
||||
ID int64 `gorm:"primaryKey;autoIncrement;column:id"`
|
||||
PartnerID int64 `gorm:"type:int;column:partner_id"`
|
||||
SiteID int64 `gorm:"type:int;column:site_id"`
|
||||
Name string `gorm:"type:varchar(255);not null;column:name"`
|
||||
Type string `gorm:"type:varchar;column:type"`
|
||||
Price float64 `gorm:"type:decimal;column:price"`
|
||||
IsWeekendTicket bool `gorm:"type:bool;column:is_weekend_ticket"`
|
||||
IsSeasonTicket bool `gorm:"type:bool;column:is_season_ticket"`
|
||||
Status string `gorm:"type:varchar;column:status"`
|
||||
Description string `gorm:"type:varchar(255);not null;column:description"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
|
||||
DeletedAt *time.Time `gorm:"column:deleted_at"`
|
||||
CreatedBy int64 `gorm:"type:int;column:created_by"`
|
||||
UpdatedBy int64 `gorm:"type:int;column:updated_by"`
|
||||
}
|
||||
|
||||
func (Product) TableName() string {
|
||||
return "products"
|
||||
}
|
||||
|
||||
type ProductSearch struct {
|
||||
@@ -56,9 +61,7 @@ func (e *ProductDB) ToProduct() *Product {
|
||||
Price: e.Price,
|
||||
Status: e.Status,
|
||||
Description: e.Description,
|
||||
Image: e.Image,
|
||||
BranchID: e.BranchID,
|
||||
StockQty: e.StockQty,
|
||||
PartnerID: e.PartnerID,
|
||||
CreatedAt: e.CreatedAt,
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
DeletedAt: e.DeletedAt,
|
||||
@@ -97,14 +100,6 @@ func (o *ProductDB) ToUpdatedProduct(updatedby int64, req Product) {
|
||||
if req.Description != "" {
|
||||
o.Description = req.Description
|
||||
}
|
||||
|
||||
if req.Image != "" {
|
||||
o.Image = req.Image
|
||||
}
|
||||
|
||||
if req.StockQty > 0 {
|
||||
o.StockQty = req.StockQty
|
||||
}
|
||||
}
|
||||
|
||||
func (o *ProductDB) SetDeleted(updatedby int64) {
|
||||
|
||||
Reference in New Issue
Block a user