now up and running using docker

This commit is contained in:
2025-04-17 15:22:55 +02:00
parent 5337da219e
commit 22b6f3bd2a
10 changed files with 80 additions and 117 deletions

View File

@@ -12,16 +12,13 @@ type Fertilizer struct {
FertilizerTypeID uint `gorm:"not null"`
FertilizerType fertilizertype.FertilizerType `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
// Association to the ingredients. This represents the composition.
Ingredients []FertilizerIngredient `gorm:"not null; many2many:fertilizer_ingredient"`
Ingredients []ingredient.Ingredient `gorm:"not null; many2many:fertilizer_ingredient"`
}
type FertilizerIngredient struct {
FertilizerAssetID uint `gorm:"primaryKey"` // foreign key to the fertilizer assets
IngredientID uint `gorm:"primaryKey"` // foreign key to the ingredient
Amount float64 `gorm:"not null"` // amount of the ingredient
// Preload the ingredient details if needed.
Ingredient ingredient.Ingredient `gorm:"not null"`
FertilizerID uint `gorm:"primaryKey"` // foreign key to the fertilizer assets
IngredientID uint `gorm:"primaryKey"` // foreign key to the ingredient
Amount float64 `gorm:"not null"` // amount of the ingredient
}
func RegisterModels() {