started datamodelling papas excel tables
This commit is contained in:
41
wagfarm-api/models/log_models.go
Normal file
41
wagfarm-api/models/log_models.go
Normal file
@@ -0,0 +1,41 @@
|
||||
type Log struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"not null"`
|
||||
Notes string
|
||||
LogType string `gorm:"not null"`
|
||||
Date Datetime.Time `gorm:"type:date;default:CURRENT_DATE"not null`
|
||||
Duration float64 `gorm:"not null"` // in hours
|
||||
VisibiltyID uint `gorm:"not null"`
|
||||
Visibility Taxonomy `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
}
|
||||
|
||||
type _LogMetadata struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
LogID uint `gorm:"not null"`
|
||||
Log Log `gorm:"foreignKey:LogID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
}
|
||||
|
||||
type _FieldWorkLog struct {
|
||||
_LogMetadata
|
||||
WorkedAreaPercentage float64 `gorm:"not null"`
|
||||
MachineID uint `gorm:"not null"`
|
||||
Machine Machine `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
}
|
||||
|
||||
type SeedingLog struct {
|
||||
_FieldWorkLog
|
||||
SeedID uint `gorm:"not null"`
|
||||
Seed Seed `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
TechniqueID uint `gorm:"not null"`
|
||||
Technique Taxonomy `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
Amount float64 `gorm:"not null"` // in units/ha
|
||||
ConditionsID uint `gorm:"not null"`
|
||||
Conditions Taxonomy `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
}
|
||||
|
||||
type FertilizingLog struct {
|
||||
_FieldWorkLog
|
||||
FertilizerID uint `gorm:"not null"`
|
||||
Fertilizer Fertilizer `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
Amount float64 `gorm:"not null"` // in units/ha
|
||||
}
|
||||
Reference in New Issue
Block a user