Update template email
This commit is contained in:
@@ -36,14 +36,11 @@ func (r *SiteRepository) Upsert(ctx context.Context, site *entity.Site) (*entity
|
||||
|
||||
if len(site.Products) > 0 {
|
||||
for i := range site.Products {
|
||||
site.Products[i].SiteID = site.ID
|
||||
if site.Products[i].ID != 0 {
|
||||
// Update existing product
|
||||
if err := tx.Save(&site.Products[i]).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// Create new product
|
||||
if err := tx.Create(&site.Products[i]).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user