final project structure

This commit is contained in:
matze committed 2025-04-15 22:36:22 +02:00
1 parent d6b3e88b5f
commit 284a40fac2
65 files changed
+668 -447

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
package plant
import (
"wagfarm-api/asset/base"
"wagfarm-api/asset/land"
)
type Plant struct {
base.Asset
LandId uint `gorm:"not null"`
Land land.Land `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
CropID uint `gorm:"not null"`
Crop crop.Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
CoverCropID uint `gorm:"not null"`
CoverCrop crop.Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Year uint `gorm:"not null"`
AreaPercentage float64 `gorm:"not null"`
}
+11
View File
@@ -0,0 +1,11 @@
package plant
import (
"wagfarm-api/generic"
"github.com/gin-gonic/gin"
)
func RegisterRoutes(rg *gin.RouterGroup) {
generic.RegisterCRUDRoutes(rg.Group("/plant"), generic.DefaultCRUDController[Plant]())
}