add product inventory
This commit is contained in:
@@ -3,6 +3,7 @@ package mappers
|
||||
import (
|
||||
"apskel-pos-be/internal/entities"
|
||||
"apskel-pos-be/internal/models"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func InventoryEntityToModel(entity *entities.Inventory) *models.Inventory {
|
||||
@@ -53,10 +54,16 @@ func InventoryEntityToResponse(entity *entities.Inventory) *models.InventoryResp
|
||||
return nil
|
||||
}
|
||||
|
||||
productName := ""
|
||||
if entity.Product.ID != uuid.Nil {
|
||||
productName = entity.Product.Name
|
||||
}
|
||||
|
||||
return &models.InventoryResponse{
|
||||
ID: entity.ID,
|
||||
OutletID: entity.OutletID,
|
||||
ProductID: entity.ProductID,
|
||||
ProductName: productName,
|
||||
Quantity: entity.Quantity,
|
||||
ReorderLevel: entity.ReorderLevel,
|
||||
IsLowStock: entity.IsLowStock(),
|
||||
|
||||
Reference in New Issue
Block a user