mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-13 22:39:06 +02:00
restructure pkg and internal
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,14 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
)
|
||||
|
||||
func (srv *server) CreatePerson(c *gin.Context) {}
|
||||
|
||||
func (srv *server) SoftDeletePerson(c *gin.Context, id int, params SoftDeletePersonParams) {}
|
||||
func (srv *server) SoftDeletePerson(c *gin.Context, id int, params api.SoftDeletePersonParams) {}
|
||||
|
||||
func (srv *server) UpdatePerson(c *gin.Context, id int, params UpdatePersonParams) {}
|
||||
func (srv *server) UpdatePerson(c *gin.Context, id int, params api.UpdatePersonParams) {}
|
||||
|
||||
func (srv *server) HardDeletePerson(c *gin.Context, id int, params HardDeletePersonParams) {}
|
||||
func (srv *server) HardDeletePerson(c *gin.Context, id int, params api.HardDeletePersonParams) {}
|
||||
|
@@ -1,6 +1,9 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
)
|
||||
|
||||
func (srv *server) CreatePersonAndRelationship(c *gin.Context, id int, params CreatePersonAndRelationshipParams) {
|
||||
func (srv *server) CreatePersonAndRelationship(c *gin.Context, id int, params api.CreatePersonAndRelationshipParams) {
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
)
|
||||
|
||||
func (srv *server) GetRecipesByPersonId(c *gin.Context, id int, params GetRecipesByPersonIdParams) {}
|
||||
func (srv *server) GetRecipesByPersonId(c *gin.Context, id int, params api.GetRecipesByPersonIdParams) {
|
||||
}
|
||||
|
@@ -1,9 +1,12 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
)
|
||||
|
||||
func (srv *server) DeleteRecipeRelationship(c *gin.Context, recipeId int, params DeleteRecipeRelationshipParams) {
|
||||
func (srv *server) DeleteRecipeRelationship(c *gin.Context, recipeId int, params api.DeleteRecipeRelationshipParams) {
|
||||
}
|
||||
|
||||
func (srv *server) CreateRecipeRelationship(c *gin.Context, recipeId int, params CreateRecipeRelationshipParams) {
|
||||
func (srv *server) CreateRecipeRelationship(c *gin.Context, recipeId int, params api.CreateRecipeRelationshipParams) {
|
||||
}
|
||||
|
@@ -1,9 +1,12 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
)
|
||||
|
||||
func (srv *server) SoftDeleteRecipe(c *gin.Context, id int, params SoftDeleteRecipeParams) {}
|
||||
func (srv *server) SoftDeleteRecipe(c *gin.Context, id int, params api.SoftDeleteRecipeParams) {}
|
||||
|
||||
func (srv *server) UpdateRecipe(c *gin.Context, id int, params UpdateRecipeParams) {}
|
||||
func (srv *server) UpdateRecipe(c *gin.Context, id int, params api.UpdateRecipeParams) {}
|
||||
|
||||
func (srv *server) HardDeleteRecipe(c *gin.Context, id int, params HardDeleteRecipeParams) {}
|
||||
func (srv *server) HardDeleteRecipe(c *gin.Context, id int, params api.HardDeleteRecipeParams) {}
|
||||
|
@@ -1,7 +1,11 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
)
|
||||
|
||||
func (srv *server) CreateRelationship(c *gin.Context, params CreateRelationshipParams) {}
|
||||
func (srv *server) CreateRelationship(c *gin.Context, params api.CreateRelationshipParams) {}
|
||||
|
||||
func (srv *server) GetRelationship(c *gin.Context, id1 int, id2 int, params GetRelationshipParams) {}
|
||||
func (srv *server) GetRelationship(c *gin.Context, id1 int, id2 int, params api.GetRelationshipParams) {
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/gin/healthcheck"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
@@ -16,7 +17,7 @@ type server struct {
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func New(logger *zap.Logger, drv neo4j.DriverWithContext, healthcheck healthcheck.HealthCheck, databaseOperationTimeoutInMs time.Duration) ServerInterface {
|
||||
func New(logger *zap.Logger, drv neo4j.DriverWithContext, healthcheck healthcheck.HealthCheck, databaseOperationTimeoutInMs time.Duration) api.ServerInterface {
|
||||
if logger == nil {
|
||||
panic("logger is required")
|
||||
}
|
||||
|
@@ -12,9 +12,10 @@ import (
|
||||
"github.com/gin-contrib/cors"
|
||||
ginzap "github.com/gin-contrib/zap"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/internal/api"
|
||||
apiServer "github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/internal/api"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/internal/memgraph"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/api"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/gin/healthcheck"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter/pkg/memgraph"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
@@ -27,6 +28,7 @@ var (
|
||||
memgraphPass string
|
||||
production bool
|
||||
requestTimeout time.Duration
|
||||
dbOpTimeout time.Duration
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -46,6 +48,7 @@ func init() {
|
||||
memgraphPass = viper.GetString("MEMGRAPH_PASS")
|
||||
production = viper.GetBool("PRODUCTION")
|
||||
requestTimeout = time.Duration(viper.GetInt("REQUEST_TIMEOUT")) * time.Second
|
||||
dbOpTimeout = time.Duration(viper.GetInt("DB_OP_TIMEOUT")) * time.Millisecond
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -76,7 +79,7 @@ func main() {
|
||||
router.Use(ginzap.Ginzap(logger, time.RFC3339, true))
|
||||
router.Use(ginzap.RecoveryWithZap(logger, true))
|
||||
|
||||
sApi := api.New(logger, memgraphDriver, hc)
|
||||
sApi := apiServer.New(logger, memgraphDriver, hc, dbOpTimeout)
|
||||
api.RegisterHandlersWithOptions(router, sApi, api.GinServerOptions{})
|
||||
|
||||
server := &http.Server{
|
||||
|
Reference in New Issue
Block a user