feat: implement component-item management with CRUD operations and status updates
This commit is contained in:
42
internal/models/component_item_model.go
Normal file
42
internal/models/component_item_model.go
Normal 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"`
|
||||
}
|
||||
Reference in New Issue
Block a user