29 lines
932 B
Go
29 lines
932 B
Go
package models
|
|
|
|
type AssetType struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"unique;not null" json:"name"`
|
|
}
|
|
|
|
type Asset struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
AssetTypeID uint `json:"asset_type_id"`
|
|
AssetType AssetType `gorm:"foreignKey:AssetTypeID" json:"-"`
|
|
}
|
|
|
|
type LogType struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"unique;not null" json:"name"`
|
|
}
|
|
|
|
type Log struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
LogTypeID uint `json:"log_type_id"`
|
|
LogType LogType `gorm:"foreignKey:LogTypeID" json:"-"`
|
|
Date string `gorm:"type:date;default:CURRENT_DATE" json:"date"`
|
|
Equipment []Asset `gorm:"many2many:log_equipment_asset;" json:"equipment"`
|
|
Substance []Asset `gorm:"many2many:log_substance_asset;" json:"substance"`
|
|
}
|