first try
This commit is contained in:
commit
13c4f172d9
13 files changed
+487
No files matched your search
@@ -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