Add callback and update user role

This commit is contained in:
aditya.siregar
2024-06-05 00:24:53 +07:00
parent 4d402e32c9
commit 04a89c5508
27 changed files with 388 additions and 49 deletions
+10
View File
@@ -45,6 +45,16 @@ func (b *ProductRepository) GetProductByID(ctx context.Context, id int64) (*enti
return product, nil
}
func (b *ProductRepository) GetProductByPartnerIDAndSiteID(ctx context.Context, partnerID, siteID int64) (entity.ProductList, error) {
var products []*entity.ProductDB
if err := b.db.WithContext(ctx).Where("partner_id = ? AND site_id = ?", partnerID, siteID).Find(&products).Error; err != nil {
logger.ContextLogger(ctx).Error("error when finding product by partner ID and site id", zap.Error(err))
return nil, err
}
return products, nil
}
func (b *ProductRepository) GetAllProducts(ctx context.Context, req entity.ProductSearch) (entity.ProductList, int, error) {
var products []*entity.ProductDB
var total int64