enaklo pos backend
This commit is contained in:
@@ -30,6 +30,7 @@ func (p *ProductParam) ToEntity() entity.ProductSearch {
|
||||
type Product struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
PartnerID int64 `json:"partner_id"`
|
||||
SiteID int64 `json:"site_id"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
Type string `json:"type"`
|
||||
Price float64 `json:"price" validate:"required"`
|
||||
@@ -38,6 +39,7 @@ type Product struct {
|
||||
Status string `json:"status"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
Stock int64 `json:"stock"`
|
||||
Image string `json:"image"`
|
||||
}
|
||||
|
||||
func (e *Product) ToEntity() *entity.Product {
|
||||
@@ -47,6 +49,8 @@ func (e *Product) ToEntity() *entity.Product {
|
||||
Price: e.Price,
|
||||
Status: e.Status,
|
||||
Description: e.Description,
|
||||
Stock: e.Stock,
|
||||
PartnerID: e.PartnerID,
|
||||
SiteID: e.SiteID,
|
||||
Image: e.Image,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,17 +31,14 @@ func (r *Site) ToEntity(createdBy int64) *entity.Site {
|
||||
var products []entity.Product
|
||||
for _, p := range r.Products {
|
||||
products = append(products, entity.Product{
|
||||
ID: p.ID,
|
||||
PartnerID: *r.PartnerID,
|
||||
Name: p.Name,
|
||||
Type: p.Type,
|
||||
Price: p.Price,
|
||||
IsWeekendTicket: p.IsWeekendTicket,
|
||||
IsSeasonTicket: p.IsSeasonTicket,
|
||||
Status: p.Status,
|
||||
Description: p.Description,
|
||||
CreatedBy: createdBy,
|
||||
Stock: p.Stock,
|
||||
ID: p.ID,
|
||||
PartnerID: *r.PartnerID,
|
||||
Name: p.Name,
|
||||
Type: p.Type,
|
||||
Price: p.Price,
|
||||
Status: p.Status,
|
||||
Description: p.Description,
|
||||
CreatedBy: createdBy,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user