Files
MiauInv/models/inventory.go
2026-06-07 01:54:09 +02:00

67 lines
1.9 KiB
Go

package models
type Item struct {
ID int `json:"id"`
Name string `json:"name"`
Category string `json:"category"`
Description string `json:"description"`
TotalQuantity int `json:"total_quantity"` // Berechnet aus der Summe aller Stocks
FreeQuantity int `json:"free_quantity"` // TotalQuantity minus Summe aller Projekt-Zuweisungen
}
type Location struct {
ID int `json:"id"`
Name string `json:"name"`
}
type Project struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
type Stock struct {
ID int `json:"id"`
ItemID int `json:"item_id"`
LocationID int `json:"location_id"`
Quantity int `json:"quantity"`
LocationName string `json:"location_name"` // Used to display the location in the modal table
}
type Association struct {
ID int `json:"id"`
ProjectID int `json:"project_id"`
ItemID int `json:"item_id"`
Quantity int `json:"quantity"`
ItemName string `json:"item_name"` // Used to display the item name in the modal table
}
type ProjectItem struct {
ID int `json:"id"`
ItemID int `json:"item_id"`
ProjectID int `json:"project_id"`
Quantity int `json:"quantity"`
}
type ItemExtended struct {
ID int `json:"id"`
Name string `json:"name"`
Category string `json:"category"`
Description string `json:"description"`
TotalQuantity int `json:"total_quantity"` // Summe aus allen Stock-Einträgen
AllocatedQty int `json:"allocated_quantity"` // Summe aus allen Projekt-Zuweisungen
AvailableQty int `json:"available_quantity"` // Total - Allocated
}
type LocationContent struct {
ItemID int `json:"item_id"`
ItemName string `json:"item_name"`
Quantity int `json:"quantity"`
}
type ProjectDetailItem struct {
ItemID int `json:"item_id"`
ItemName string `json:"item_name"`
Quantity int `json:"quantity"`
}