feat(BE-48): auto-create product_warehouse on stock adjustment & remove unused APIs

- Change logic: automatically create product_warehouse if it does not exist during stock adjustment
- Remove unnecessary/unused API endpoints
- Ensure adjustment process continues even if product_warehouse was not previously available
This commit is contained in:
aguhh18
2025-10-13 11:38:05 +07:00
parent ce28429efd
commit 5283aed996
8 changed files with 69 additions and 207 deletions
@@ -14,6 +14,7 @@ type WarehouseRepository interface {
LocationExists(ctx context.Context, locationId uint) (bool, error)
KandangExists(ctx context.Context, kandangId uint) (bool, error)
NameExists(ctx context.Context, name string, excludeID *uint) (bool, error)
IdExists(ctx context.Context, id uint) (bool, error)
}
type WarehouseRepositoryImpl struct {
@@ -43,3 +44,6 @@ func (r *WarehouseRepositoryImpl) KandangExists(ctx context.Context, kandangId u
func (r *WarehouseRepositoryImpl) NameExists(ctx context.Context, name string, excludeID *uint) (bool, error) {
return repository.ExistsByName[entity.Warehouse](ctx, r.db, name, excludeID)
}
func (r *WarehouseRepositoryImpl) IdExists(ctx context.Context, id uint) (bool, error) {
return repository.Exists[entity.Warehouse](ctx, r.db, id)
}