final project structure
This commit is contained in:
8
wagfarm-api/taxonomy/base/model.go
Normal file
8
wagfarm-api/taxonomy/base/model.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package base
|
||||
|
||||
type Taxonomy struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"not null;index" json:"name"` // e.g., "kg", "lb"
|
||||
}
|
||||
|
||||
func (t Taxonomy) GetID() uint { return t.ID }
|
||||
5
wagfarm-api/taxonomy/crop/model.go
Normal file
5
wagfarm-api/taxonomy/crop/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package crop
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type Crop struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/crop/route.go
Normal file
11
wagfarm-api/taxonomy/crop/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package crop
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/crop"), generic.DefaultCRUDController[Crop]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/customer/model.go
Normal file
5
wagfarm-api/taxonomy/customer/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package customer
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type Customer struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/customer/route.go
Normal file
11
wagfarm-api/taxonomy/customer/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package customer
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/customer"), generic.DefaultCRUDController[Customer]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/fertilizertype/model.go
Normal file
5
wagfarm-api/taxonomy/fertilizertype/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package fertilizertype
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type FertilizerType struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/fertilizertype/route.go
Normal file
11
wagfarm-api/taxonomy/fertilizertype/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package fertilizertype
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/fertilizertype"), generic.DefaultCRUDController[FertilizerType]())
|
||||
}
|
||||
12
wagfarm-api/taxonomy/ingredient/model.go
Normal file
12
wagfarm-api/taxonomy/ingredient/model.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package ingredient
|
||||
|
||||
import (
|
||||
"wagfarm-api/taxonomy/base"
|
||||
"wagfarm-api/taxonomy/unit"
|
||||
)
|
||||
|
||||
type Ingredient struct {
|
||||
base.Taxonomy
|
||||
UnitID uint `gorm:"not null"`
|
||||
Unit unit.Unit `gorm:"not null"`
|
||||
}
|
||||
11
wagfarm-api/taxonomy/ingredient/route.go
Normal file
11
wagfarm-api/taxonomy/ingredient/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package ingredient
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/ingredient"), generic.DefaultCRUDController[Ingredient]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/pesticidetype/model.go
Normal file
5
wagfarm-api/taxonomy/pesticidetype/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package pesticidetype
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type PesticideType struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/pesticidetype/route.go
Normal file
11
wagfarm-api/taxonomy/pesticidetype/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package pesticidetype
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/pesticidetype"), generic.DefaultCRUDController[PesticideType]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/producttype/model.go
Normal file
5
wagfarm-api/taxonomy/producttype/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package producttype
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type ProductType struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/producttype/route.go
Normal file
11
wagfarm-api/taxonomy/producttype/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package producttype
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/producttype"), generic.DefaultCRUDController[ProductType]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/seedingcondition/model.go
Normal file
5
wagfarm-api/taxonomy/seedingcondition/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package seedingcondition
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type SeedingCondition struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/seedingcondition/route.go
Normal file
11
wagfarm-api/taxonomy/seedingcondition/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package seedingcondition
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/seedingcondition"), generic.DefaultCRUDController[SeedingCondition]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/seedingtechnique/model.go
Normal file
5
wagfarm-api/taxonomy/seedingtechnique/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package seedingtechnique
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type SeedingTechnique struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/seedingtechnique/route.go
Normal file
11
wagfarm-api/taxonomy/seedingtechnique/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package seedingtechnique
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/seedingtechnique"), generic.DefaultCRUDController[SeedingTechnique]())
|
||||
}
|
||||
12
wagfarm-api/taxonomy/seedtype/model.go
Normal file
12
wagfarm-api/taxonomy/seedtype/model.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package seedtype
|
||||
|
||||
import (
|
||||
"wagfarm-api/taxonomy/base"
|
||||
"wagfarm-api/taxonomy/crop"
|
||||
)
|
||||
|
||||
type SeedType struct {
|
||||
base.Taxonomy
|
||||
CropID uint `gorm:"not null"`
|
||||
Crop crop.Crop `gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||
}
|
||||
11
wagfarm-api/taxonomy/seedtype/route.go
Normal file
11
wagfarm-api/taxonomy/seedtype/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package seedtype
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/seedtype"), generic.DefaultCRUDController[SeedType]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/seller/model.go
Normal file
5
wagfarm-api/taxonomy/seller/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package seller
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type Seller struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/seller/route.go
Normal file
11
wagfarm-api/taxonomy/seller/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package seller
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/seller"), generic.DefaultCRUDController[Seller]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/unit/model.go
Normal file
5
wagfarm-api/taxonomy/unit/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package unit
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type Unit struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/unit/route.go
Normal file
11
wagfarm-api/taxonomy/unit/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/unit"), generic.DefaultCRUDController[Unit]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/visibility/model.go
Normal file
5
wagfarm-api/taxonomy/visibility/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package visibility
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type Visibility struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/visibility/route.go
Normal file
11
wagfarm-api/taxonomy/visibility/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package visibility
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/visibility"), generic.DefaultCRUDController[Visibility]())
|
||||
}
|
||||
5
wagfarm-api/taxonomy/worker/model.go
Normal file
5
wagfarm-api/taxonomy/worker/model.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package worker
|
||||
|
||||
import "wagfarm-api/taxonomy/base"
|
||||
|
||||
type Worker struct{ base.Taxonomy }
|
||||
11
wagfarm-api/taxonomy/worker/route.go
Normal file
11
wagfarm-api/taxonomy/worker/route.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package worker
|
||||
|
||||
import (
|
||||
"wagfarm-api/generic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterRoutes(rg *gin.RouterGroup) {
|
||||
generic.RegisterCRUDRoutes(rg.Group("/worker"), generic.DefaultCRUDController[Worker]())
|
||||
}
|
||||
Reference in New Issue
Block a user