mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'dev/ragil-before-sso' of https://gitlab.com/mbugroup/lti-api into dev/teguh
This commit is contained in:
+15
@@ -23,6 +23,7 @@ type ProductWarehouseRepository interface {
|
||||
GetFirstProductByFlag(ctx context.Context, flagName string) (*entity.Product, error)
|
||||
ApplyFlagsFilter(db *gorm.DB, flags []string) *gorm.DB
|
||||
AdjustQuantities(ctx context.Context, deltas map[uint]float64, modifier func(*gorm.DB) *gorm.DB) error
|
||||
GetDetailByID(ctx context.Context, id uint) (*entity.ProductWarehouse, error)
|
||||
}
|
||||
|
||||
type ProductWarehouseRepositoryImpl struct {
|
||||
@@ -149,6 +150,20 @@ func (r *ProductWarehouseRepositoryImpl) AdjustQuantities(ctx context.Context, d
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *ProductWarehouseRepositoryImpl) GetDetailByID(ctx context.Context, id uint) (*entity.ProductWarehouse, error) {
|
||||
var productWarehouse entity.ProductWarehouse
|
||||
err := r.DB().WithContext(ctx).
|
||||
Preload("Product").
|
||||
Preload("Warehouse").
|
||||
Preload("Warehouse.Area").
|
||||
Preload("Warehouse.Location").
|
||||
First(&productWarehouse, id).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &productWarehouse, nil
|
||||
}
|
||||
|
||||
func (r *ProductWarehouseRepositoryImpl) GetFirstProductByCategoryCode(ctx context.Context, categoryCode string) (*entity.Product, error) {
|
||||
var product entity.Product
|
||||
err := r.DB().WithContext(ctx).
|
||||
|
||||
Reference in New Issue
Block a user