first try
This commit is contained in:
28
wagfarm-api/models/models.go
Normal file
28
wagfarm-api/models/models.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user