datamodel done without validators

This commit is contained in:
2025-04-17 12:33:53 +02:00
parent 284a40fac2
commit 5337da219e
58 changed files with 575 additions and 227 deletions

View File

@@ -3,7 +3,10 @@ package main
import (
"log"
"os"
"wagfarm-api/assets"
"wagfarm-api/database"
"wagfarm-api/logs"
"wagfarm-api/taxonomy"
"github.com/gin-gonic/gin"
)
@@ -25,8 +28,17 @@ func initLogging() {
gin.DefaultWriter = f // capture Gin logs too
}
func RegisterRoutes(r *gin.Engine) {
func RegisterModels() {
assets.RegisterModels()
logs.RegisterModels()
taxonomy.RegisterModels()
}
func RegisterRoutes(r *gin.Engine) {
group := r.Group("/v1")
assets.RegisterRoutes(group)
logs.RegisterRoutes(group)
taxonomy.RegisterRoutes(group)
}
func main() {
@@ -39,6 +51,8 @@ func main() {
log.Fatalf("Database connection error: %v", err)
}
RegisterModels()
// Run migrations.
if err := database.Migrate(); err != nil {
log.Fatalf("Migration failed: %v", err)