feat: enhance GetAllByReturnId method with preload for related entities
Deploy Application / deploy (push) Successful in 19s
Details
Deploy Application / deploy (push) Successful in 19s
Details
This commit is contained in:
parent
a6eb6c6ca0
commit
d962d77a00
|
|
@ -46,7 +46,11 @@ func (r *inventoryReturnLineRepository) DeleteByReturnId(ctx context.Context, tx
|
|||
// GetAllByReturnId implements InventoryReturnLineRepository.
|
||||
func (r *inventoryReturnLineRepository) GetAllByReturnId(ctx context.Context, returnId string) ([]entities.TInventoryReturnLineEntity, error) {
|
||||
var lines []entities.TInventoryReturnLineEntity
|
||||
if err := r.db.WithContext(ctx).Where("inv_return_id = ?", returnId).Find(&lines).Error; err != nil {
|
||||
if err := r.db.WithContext(ctx).Where("inv_return_id = ?", returnId).
|
||||
Preload("Product").
|
||||
Preload("InvReturn").
|
||||
Preload("Client").
|
||||
Find(&lines).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return lines, nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue