package base import "time" type BaseLog struct { ID uint `gorm:"primaryKey"` Name string `gorm:"not null"` Notes string `gorm:"not null"` LogType string `gorm:"not null"` Date time.Time `gorm:"default:CURRENT_TIME"` Duration float64 `gorm:"not null"` // in hours VisibiltyID uint `gorm:"not null"` Visibility taxonomy.Visibility `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"` } func (l BaseLog) GetID() uint { return l.ID } type ExtendedLog struct { ID uint `gorm:"primaryKey"` LogID uint `gorm:"not null"` BaseLog BaseLog `gorm:"foreignKey:LogID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"` } func (l ExtendedLog) GetID() uint { return l.ID } type FieldWorkLog struct { ExtendedLog WorkedAreaPercentage float64 `gorm:"not null"` MachineID uint `gorm:"not null"` Machine asset.Machine `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"` }