first try

This commit is contained in:
2025-04-09 20:37:07 +02:00
commit 13c4f172d9
13 changed files with 487 additions and 0 deletions

View 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"`
}