Compare commits

..

No commits in common. "566d95bc0f887706ebf5a8f094dbfedbb13f4958" and "8bd70ec18d9a0b2ebf48b49e8b14641e07abcabd" have entirely different histories.

View File

@ -15,7 +15,6 @@ type ProviderArticleApi interface {
AutoMigrate() error
FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error
ProviderPrice(providerArticleID uint) (history []v2.ProviderPrice, err error)
UpdateStatus(article v2.ProviderArticle) error
}
type providerArticleApi struct {
@ -90,7 +89,7 @@ func (p *providerArticleApi) Get(query *GetProviderArticleQuery) (article v2.Pro
func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error {
if err := p.db.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "provider_id"}, {Name: "sku_id"}},
DoUpdates: clause.AssignmentColumns([]string{"cost", "available", "updated_at", "ast"}),
DoUpdates: clause.AssignmentColumns([]string{"cost", "available", "updated_at"}),
}).Create(&article).Error; err != nil {
return err
}
@ -99,9 +98,6 @@ func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error {
}
return nil
}
func (p *providerArticleApi) UpdateStatus(article v2.ProviderArticle) error {
return p.db.Where("id=?", article.ID).Select("status").Updates(&article).Error
}
func (p *providerArticleApi) FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error {
err := p.db.Scopes(query.Scope).Preload("CalculateProcess").FindInBatches(results, 20, f).Error