trying around with different routing and controller structures
This commit is contained in:
44
wagfarm-api/models/taxonomy.go
Normal file
44
wagfarm-api/models/taxonomy.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package models
|
||||
|
||||
var TaxonomyModels = []interface{}{
|
||||
&Unit{},
|
||||
&Visibility{},
|
||||
&SeedingTechnique{},
|
||||
&SeedingCondition{},
|
||||
&Worker{},
|
||||
&Crop{},
|
||||
&Seller{},
|
||||
&Customer{},
|
||||
&SeedType{},
|
||||
&Ingredient{},
|
||||
&FertilizerType{},
|
||||
&PesticideType{},
|
||||
&ProductType{},
|
||||
}
|
||||
|
||||
type _Taxonomy struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"not null;index" json:"name"` // e.g., "kg", "lb"
|
||||
}
|
||||
|
||||
type Unit struct{ _Taxonomy }
|
||||
type Visibility struct{ _Taxonomy }
|
||||
type SeedingTechnique struct{ _Taxonomy }
|
||||
type SeedingCondition struct{ _Taxonomy }
|
||||
type Worker struct{ _Taxonomy }
|
||||
type Crop struct{ _Taxonomy }
|
||||
type Seller struct{ _Taxonomy }
|
||||
type Customer struct{ _Taxonomy }
|
||||
type SeedType struct {
|
||||
_Taxonomy
|
||||
CropID uint `gorm:"not null"`
|
||||
Crop Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||
}
|
||||
type Ingredient struct {
|
||||
_Taxonomy
|
||||
UnitID uint `gorm:"not null"`
|
||||
Unit Unit `gorm:"not null"`
|
||||
}
|
||||
type FertilizerType struct{ _Taxonomy }
|
||||
type PesticideType struct{ _Taxonomy }
|
||||
type ProductType struct{ _Taxonomy }
|
||||
Reference in New Issue
Block a user