31 lines
995 B
Go
31 lines
995 B
Go
package routes
|
|
|
|
import (
|
|
"enaklo-pos-be/internal/handlers/http"
|
|
"enaklo-pos-be/internal/handlers/http/customerauth"
|
|
"enaklo-pos-be/internal/handlers/http/discovery"
|
|
"enaklo-pos-be/internal/middlewares"
|
|
|
|
"enaklo-pos-be/internal/app"
|
|
"enaklo-pos-be/internal/repository"
|
|
"enaklo-pos-be/internal/services"
|
|
)
|
|
|
|
func RegisterCustomerRoutes(app *app.Server, serviceManager *services.ServiceManagerImpl,
|
|
repoManager *repository.RepoManagerImpl) {
|
|
approute := app.Group("/api/v1/customer")
|
|
|
|
authMiddleware := middlewares.CustomerAuthorizationMiddleware(repoManager.Crypto)
|
|
|
|
serverRoutes := []HTTPHandlerRoutes{
|
|
discovery.NewHandler(serviceManager.DiscoverService),
|
|
customerauth.NewAuthHandler(serviceManager.AuthV2Svc, serviceManager.MemberRegistrationSvc),
|
|
http.NewMenuHandler(serviceManager.ProductV2Svc, serviceManager.InProgressSvc),
|
|
http.NewCustomerOrderHandler(serviceManager.OrderV2Svc),
|
|
}
|
|
|
|
for _, handler := range serverRoutes {
|
|
handler.Route(approute, authMiddleware)
|
|
}
|
|
}
|