Import Serverfunktionen angelegt
This commit is contained in:
@@ -29,16 +29,19 @@ func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
|
||||
valueRepository := repositories.NewValueRepository(dbHandler)
|
||||
productGroupRepository := repositories.NewProductGroupRepository(dbHandler, valueRepository)
|
||||
productRepository := repositories.NewProductRepository(dbHandler, productGroupRepository, valueRepository)
|
||||
importRepository := repositories.NewImportRepository(dbHandler, productGroupRepository, productRepository, valueRepository)
|
||||
|
||||
// service initialisation:
|
||||
valueService := services.NewValueService(valueRepository)
|
||||
productGroupService := services.NewProductGroupService(productGroupRepository)
|
||||
productService := services.NewProductService(productRepository)
|
||||
importService := services.NewImportService(importRepository)
|
||||
|
||||
// controller initialisation:
|
||||
valueController := controller.NewValueController(valueService)
|
||||
productGroupController := controller.NewProductGroupController(productGroupService, valueService)
|
||||
productController := controller.NewProductController(productService, productGroupService, valueService)
|
||||
importController := controller.NewImportController(importService)
|
||||
|
||||
// Service API
|
||||
router := gin.Default()
|
||||
@@ -89,6 +92,11 @@ func InitHttpServer(config *viper.Viper, dbHandler *sql.DB) HttpServer {
|
||||
router.POST("/addPropertyToProductId/:productId", productController.AddPropertyToProductId) // add Property to Product by ID
|
||||
router.DELETE("/deletePropertyFromProductId/:productId", productController.DeletePropertyFromProductId) // delete Property from Product by ID
|
||||
|
||||
// Import functionality
|
||||
router.POST("/importPropertyTypeGroups", importController.ImportPropertyTypeGroups) // import PropertyTypeGroups
|
||||
router.POST("/importProductGroups", importController.ImportProductGroups) // import ProductGroups
|
||||
router.POST("/importProducts", importController.ImportProducts) // import Products
|
||||
|
||||
// server
|
||||
return HttpServer{
|
||||
config: config,
|
||||
|
||||
Reference in New Issue
Block a user