diff --git a/structs/storage/provider-article.go b/structs/storage/provider-article.go index 1252fd4..1a523c9 100644 --- a/structs/storage/provider-article.go +++ b/structs/storage/provider-article.go @@ -15,6 +15,7 @@ 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 { @@ -98,6 +99,9 @@ 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