feat: add endpoints for retrieving stock alerts and anomaly items, including database queries and models
This commit is contained in:
@@ -32,3 +32,29 @@ func ToDomainContainerStats(r db.GetContainerStatsRow) models.ContainerStats {
|
||||
EmptyContainers: int64(r.EmptyContainers),
|
||||
}
|
||||
}
|
||||
|
||||
func ToDomainStockAlert(r db.GetStockAlertsRow) models.StockAlert {
|
||||
return models.StockAlert{
|
||||
ID: r.ID,
|
||||
Name: r.Name,
|
||||
Unit: r.Unit,
|
||||
TotalQuantity: r.TotalQuantity,
|
||||
MinQuantity: r.MinQuantity,
|
||||
ComponentTypeID: r.ComponentTypeID,
|
||||
ComponentTypeName: r.ComponentTypeName.String,
|
||||
}
|
||||
}
|
||||
|
||||
func ToDomainAnomalyItem(r db.GetAnomalyItemsRow) models.AnomalyItem {
|
||||
return models.AnomalyItem{
|
||||
ID: r.ID,
|
||||
ComponentID: r.ComponentID,
|
||||
ContainerID: r.ContainerID,
|
||||
Quantity: r.Quantity,
|
||||
Status: string(r.Status),
|
||||
CreatedAt: r.CreatedAt,
|
||||
UpdatedAt: r.UpdatedAt,
|
||||
ComponentName: r.ComponentName,
|
||||
ComponentUnit: r.ComponentUnit,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user