25 lines
843 B
Go
25 lines
843 B
Go
package base
|
|
|
|
import (
|
|
"time"
|
|
"wagfarm-api/database"
|
|
"wagfarm-api/taxonomy/visibility"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
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:"not null"`
|
|
Duration float64 `gorm:"not null"` // in hours
|
|
VisibilityID uint `gorm:"not null"`
|
|
Visibility visibility.Visibility `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
|
Cost decimal.Decimal `gorm:"not null;type:decimal(10,2);"` // in euro
|
|
}
|
|
|
|
func (l BaseLog) GetID() uint { return l.ID }
|
|
func RegisterModels() { database.RegisterModel(&BaseLog{}) }
|