mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
unfinished purchase
This commit is contained in:
@@ -17,6 +17,7 @@ type WarehouseRepository interface {
|
||||
IdExists(ctx context.Context, id uint) (bool, error)
|
||||
GetByKandangID(ctx context.Context, kandangId uint) (*entity.Warehouse, error)
|
||||
GetLatestByKandangID(ctx context.Context, kandangId uint) (*entity.Warehouse, error)
|
||||
GetDetailByID(ctx context.Context, id uint) (*entity.Warehouse, error)
|
||||
}
|
||||
|
||||
type WarehouseRepositoryImpl struct {
|
||||
@@ -62,6 +63,18 @@ func (r *WarehouseRepositoryImpl) GetByKandangID(ctx context.Context, kandangId
|
||||
return &warehouse, nil
|
||||
}
|
||||
|
||||
func (r *WarehouseRepositoryImpl) GetDetailByID(ctx context.Context, id uint) (*entity.Warehouse, error) {
|
||||
var warehouse entity.Warehouse
|
||||
err := r.db.WithContext(ctx).
|
||||
Preload("Area").
|
||||
Preload("Location").
|
||||
First(&warehouse, id).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &warehouse, nil
|
||||
}
|
||||
|
||||
func (r *WarehouseRepositoryImpl) GetLatestByKandangID(ctx context.Context, kandangId uint) (*entity.Warehouse, error) {
|
||||
var warehouse entity.Warehouse
|
||||
err := r.db.WithContext(ctx).
|
||||
|
||||
Reference in New Issue
Block a user