feat: implement component-item management with CRUD operations and status updates

This commit is contained in:
Tran Anh Tuan
2026-05-11 17:49:18 +07:00
parent 9ea72b4eea
commit 0ff65a18c0
23 changed files with 3870 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package models
import (
"encoding/json"
"time"
)
type ComponentItem struct {
ID int64 `json:"id"`
ComponentID int64 `json:"componentId"`
ContainerID int64 `json:"containerId"`
Quantity int32 `json:"quantity"`
Status string `json:"status"`
Metadata json.RawMessage `json:"metadata"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// UpdateStatusResult holds the results of a component item status change operation.
// Different fields are populated depending on the case:
// - Case 1 (change all): only ComponentItem and StatusHistory are set
// - Case 2 (split): NewComponentItemID is also set
// - Case 3 (merge): MergedComponentItemID is also set
type UpdateStatusResult struct {
ComponentItem ComponentItem
StatusHistory ComponentStatusHistory
NewComponentItemID *int64
MergedComponentItemID *int64
}
type FindComponentItemResult struct {
ComponentName string `json:"componentName"`
TypeName string `json:"typeName"`
Quantity int32 `json:"quantity"`
Status string `json:"status"`
ContainerName string `json:"containerName"`
ContainerType string `json:"containerType"`
ShelfName string `json:"shelfName"`
CabinetName string `json:"cabinetName"`
RoomName string `json:"roomName"`
WarehouseName string `json:"warehouseName"`
}