2025-11-15 17:43:23 +00:00
|
|
|
package product_specifications
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"jaecoo-be/app/module/product_specifications/controller"
|
|
|
|
|
"jaecoo-be/app/module/product_specifications/repository"
|
|
|
|
|
"jaecoo-be/app/module/product_specifications/service"
|
|
|
|
|
|
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
|
"go.uber.org/fx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ProductSpecificationsRouter struct of ProductSpecificationsRouter
|
|
|
|
|
type ProductSpecificationsRouter struct {
|
|
|
|
|
App fiber.Router
|
|
|
|
|
Controller *controller.Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewProductSpecificationsModule register bulky of ProductSpecifications module
|
|
|
|
|
var NewProductSpecificationsModule = fx.Options(
|
|
|
|
|
// register repository of ProductSpecifications module
|
|
|
|
|
fx.Provide(repository.NewProductSpecificationsRepository),
|
|
|
|
|
|
|
|
|
|
// register service of ProductSpecifications module
|
|
|
|
|
fx.Provide(service.NewProductSpecificationsService),
|
|
|
|
|
|
|
|
|
|
// register controller of ProductSpecifications module
|
|
|
|
|
fx.Provide(controller.NewController),
|
|
|
|
|
|
|
|
|
|
// register router of ProductSpecifications module
|
|
|
|
|
fx.Provide(NewProductSpecificationsRouter),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// NewProductSpecificationsRouter init ProductSpecificationsRouter
|
|
|
|
|
func NewProductSpecificationsRouter(fiber *fiber.App, controller *controller.Controller) *ProductSpecificationsRouter {
|
|
|
|
|
return &ProductSpecificationsRouter{
|
|
|
|
|
App: fiber,
|
|
|
|
|
Controller: controller,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RegisterProductSpecificationsRoutes register routes of ProductSpecifications module
|
|
|
|
|
func (_i *ProductSpecificationsRouter) RegisterProductSpecificationsRoutes() {
|
|
|
|
|
// define controllers
|
|
|
|
|
productSpecificationsController := _i.Controller.ProductSpecifications
|
|
|
|
|
|
|
|
|
|
// define routes
|
|
|
|
|
_i.App.Route("/product-specifications", func(router fiber.Router) {
|
|
|
|
|
router.Get("/", productSpecificationsController.All)
|
2025-11-17 15:30:00 +00:00
|
|
|
router.Get("/viewer/:filename", productSpecificationsController.Viewer)
|
2025-11-15 17:43:23 +00:00
|
|
|
router.Get("/:id", productSpecificationsController.Show)
|
|
|
|
|
router.Post("/", productSpecificationsController.Save)
|
|
|
|
|
router.Put("/:id", productSpecificationsController.Update)
|
|
|
|
|
router.Delete("/:id", productSpecificationsController.Delete)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|