21 lines
530 B
Go
21 lines
530 B
Go
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"`
|
|
Unit string `json:"unit"` // Satuan dari komponen
|
|
Note string `json:"note,omitempty"`
|
|
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|