Update API

This commit is contained in:
2025-06-22 23:23:26 +07:00
parent b077ef9f06
commit 40705fbf3b
63 changed files with 1976 additions and 81 deletions
+10
View File
@@ -0,0 +1,10 @@
package models
import "time"
type Collection struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"`
CreatedAt time.Time
UpdatedAt time.Time
}
+11
View File
@@ -0,0 +1,11 @@
package models
import "time"
type Colour struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"`
Code string `json:"code"` // contoh: HEX (#000000) atau RGB
CreatedAt time.Time
UpdatedAt time.Time
}
+29
View File
@@ -0,0 +1,29 @@
package models
import "time"
type Product struct {
ID uint `gorm:"primaryKey" json:"id"`
CategoryID uint `json:"category_id"`
Category ProductCategory `gorm:"foreignKey:CategoryID" json:"category"`
CollectionID uint `json:"collection_id"`
Collection Collection `gorm:"foreignKey:CollectionID" json:"collection"`
ColourID uint `json:"colour_id"`
Colour Colour `gorm:"foreignKey:ColourID" json:"colour"`
SizeID uint `json:"size_id"`
Size Size `gorm:"foreignKey:SizeID" json:"size"`
SKU string `gorm:"not null;unique" json:"sku"`
Name string `gorm:"not null" json:"name"`
Description string `json:"description"`
UnitOfMeasure string `json:"unit_of_measure"`
IsRawMaterial bool `json:"is_raw_material"`
IsFinishedGood bool `json:"is_finished_good"`
CreatedAt time.Time
UpdatedAt time.Time
}
@@ -0,0 +1,10 @@
package models
import "time"
type ProductCategory struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"`
CreatedAt time.Time
UpdatedAt time.Time
}
@@ -0,0 +1,18 @@
package models
import "time"
type ProductComponent struct {
ID uint `gorm:"primaryKey" json:"id"`
ProductID uint `json:"product_id"` // Produk utama
Product Product `gorm:"foreignKey:ProductID" json:"product"`
ComponenID uint `json:"componen_id"` // Komponen produk
Component Product `gorm:"foreignKey:ComponenID" json:"component"`
Quantity float64 `json:"quantity"`
CreatedAt time.Time
UpdatedAt time.Time
}
@@ -0,0 +1,21 @@
package models
import "time"
type ProductionOrder struct {
ID uint `gorm:"primaryKey" json:"id"`
ProductID uint `json:"product_id"`
Product Product `gorm:"foreignKey:ProductID" json:"product"`
ProductionID string `gorm:"not null;unique" json:"production_id"` // kode batch
TargetQuantity float64 `json:"target_quantity"`
Status string `json:"status"` // contoh: "planned", "in_progress", "done"
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
Note string `json:"note"`
CreatedAt time.Time
UpdatedAt time.Time
}
+11
View File
@@ -0,0 +1,11 @@
package models
import "time"
type Size struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"` // contoh: S, M, L, XL
Description string `json:"description"` // opsional, seperti "Small", "Large"
CreatedAt time.Time
UpdatedAt time.Time
}
@@ -0,0 +1,24 @@
package models
import "time"
type StockMovement struct {
ID uint `gorm:"primaryKey" json:"id"`
ProductID uint `json:"product_id"`
Product Product `gorm:"foreignKey:ProductID" json:"product"`
OriginWarehouseID uint `json:"origin_warehouse_id"`
OriginWarehouse Warehouse `gorm:"foreignKey:OriginWarehouseID" json:"origin_warehouse"`
StockType string `json:"stock_type"` // contoh: "in", "out", "transfer"
DestinationWarehouseID *uint `json:"destination_warehouse_id"`
DestinationWarehouse *Warehouse `gorm:"foreignKey:DestinationWarehouseID" json:"destination_warehouse"`
Date time.Time `json:"date"`
Note string `json:"note"`
CreatedAt time.Time
UpdatedAt time.Time
}
+15
View File
@@ -0,0 +1,15 @@
package models
import "time"
type Warehouse struct {
ID uint `gorm:"primaryKey" json:"id"`
Kode string `gorm:"not null;unique" json:"kode"`
Name string `gorm:"not null" json:"name"`
Address string `json:"address"`
Stackholder string `json:"stackholder"`
Number string `json:"number"`
Description string `json:"description"`
CreatedAt time.Time
UpdatedAt time.Time
}