desc fx6
This commit is contained in:
parent
8cf3adbf74
commit
8deac3d76d
|
|
@ -66,6 +66,13 @@ func Start(w http.ResponseWriter, route *http.Request) {
|
|||
|
||||
mainImportWG.Add(len(mainCategories))
|
||||
|
||||
errDel := deleteProducts()
|
||||
|
||||
if errDel != nil {
|
||||
http.Error(w, errDel.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
for _, element := range mainCategories {
|
||||
slug := element.Translations[0].Slug
|
||||
|
||||
|
|
@ -81,12 +88,14 @@ func Start(w http.ResponseWriter, route *http.Request) {
|
|||
|
||||
}
|
||||
|
||||
func deleteProducts() {
|
||||
func deleteProducts() error {
|
||||
//todo delete non ordered & non favorited products
|
||||
//select distinct ordered and favorited product ids
|
||||
//todo delete from elastico
|
||||
//Delete from products where id in (select distinct)
|
||||
|
||||
return baza.Delete(&gm.Product{}).Error
|
||||
|
||||
}
|
||||
|
||||
func startImport(dbName string, db *gorm.DB) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue