final project structure
This commit is contained in:
12
wagfarm-api/log/fertilizing/model.go
Normal file
12
wagfarm-api/log/fertilizing/model.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package fertilizing
|
||||
|
||||
import (
|
||||
"wagfarm-api/log/base"
|
||||
)
|
||||
|
||||
type FertilizingLog struct {
|
||||
base.ExtendedLog
|
||||
FertilizerID uint `gorm:"not null"`
|
||||
Fertilizer asset.Fertilizer `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
|
||||
Amount float64 `gorm:"not null"` // in units of the fertilizer
|
||||
}
|
||||
11
wagfarm-api/log/fertilizing/route.go
Normal file
11
wagfarm-api/log/fertilizing/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package fertilizing
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/fertilizer"), generic.DefaultCRUDController[FertilizingLog]())
|
||||
}
|
||||
Reference in New Issue
Block a user