feat: add endpoints for retrieving stock alerts and anomaly items, including database queries and models

This commit is contained in:
Tran Anh Tuan
2026-05-13 18:10:34 +07:00
parent 383bed757d
commit 0a56dfeb61
11 changed files with 695 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
package models
import "time"
type TotalComponentStats struct {
TotalTypes int64 `json:"totalTypes"`
TotalQuantity int64 `json:"totalQuantity"`
@@ -28,3 +30,25 @@ type DashboardSummary struct {
TodayInvoices []TodayInvoiceCount `json:"todayInvoices"`
EmptyContainers ContainerStats `json:"emptyContainers"`
}
type StockAlert struct {
ID int64 `json:"id"`
Name string `json:"name"`
Unit string `json:"unit"`
TotalQuantity int32 `json:"totalQuantity"`
MinQuantity int32 `json:"minQuantity"`
ComponentTypeID int64 `json:"componentTypeId"`
ComponentTypeName string `json:"componentTypeName"`
}
type AnomalyItem struct {
ID int64 `json:"id"`
ComponentID int64 `json:"componentId"`
ContainerID int64 `json:"containerId"`
Quantity int32 `json:"quantity"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ComponentName string `json:"componentName"`
ComponentUnit string `json:"componentUnit"`
}