change log api to reflect data split into base and extension

This commit is contained in:
2025-04-24 15:48:21 +02:00
parent c07aa09dcd
commit 2e01287a71
13 changed files with 182 additions and 42 deletions

View File

@@ -3,14 +3,14 @@ package harvest
import (
"wagfarm-api/assets/product"
"wagfarm-api/database"
"wagfarm-api/logs/base"
"wagfarm-api/logs/generic"
"github.com/shopspring/decimal"
"gorm.io/gorm"
)
type HarvestLog struct {
base.FieldWorkLog
generic.FieldWorkLog
ProductID uint `gorm:"not null"`
Product product.Product `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null"`
Amount float64 `gorm:"not null"` // in units of the product

View File

@@ -1,11 +1,11 @@
package harvest
import (
"wagfarm-api/generic"
"wagfarm-api/logs/generic"
"github.com/gin-gonic/gin"
)
func RegisterRoutes(rg *gin.RouterGroup) {
generic.RegisterCRUDRoutes(rg.Group("/harvest"), generic.DefaultCRUDController[HarvestLog]())
generic.RegisterCRUDRoutes(rg.Group("/harvest"), generic.LogCRUDController[HarvestLog]())
}