2024-08-03 20:01:25 +07:00
|
|
|
package routes
|
|
|
|
|
|
|
|
|
|
import (
|
2025-04-26 12:23:12 +07:00
|
|
|
"enaklo-pos-be/internal/handlers/http"
|
2025-03-04 20:36:17 +07:00
|
|
|
"enaklo-pos-be/internal/handlers/http/customerauth"
|
|
|
|
|
"enaklo-pos-be/internal/handlers/http/discovery"
|
|
|
|
|
"enaklo-pos-be/internal/middlewares"
|
2024-08-03 20:01:25 +07:00
|
|
|
|
2025-03-04 20:36:17 +07:00
|
|
|
"enaklo-pos-be/internal/app"
|
|
|
|
|
"enaklo-pos-be/internal/repository"
|
|
|
|
|
"enaklo-pos-be/internal/services"
|
2024-08-03 20:01:25 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func RegisterCustomerRoutes(app *app.Server, serviceManager *services.ServiceManagerImpl,
|
|
|
|
|
repoManager *repository.RepoManagerImpl) {
|
|
|
|
|
approute := app.Group("/api/v1/customer")
|
|
|
|
|
|
2025-04-26 12:23:12 +07:00
|
|
|
authMiddleware := middlewares.CustomerAuthorizationMiddleware(repoManager.Crypto)
|
2025-06-06 21:14:28 +07:00
|
|
|
optionlMiddleWare := middlewares.OptionalCustomerAuthorizationMiddleware(repoManager.Crypto)
|
2024-08-03 20:01:25 +07:00
|
|
|
|
|
|
|
|
serverRoutes := []HTTPHandlerRoutes{
|
|
|
|
|
discovery.NewHandler(serviceManager.DiscoverService),
|
2025-05-03 10:50:41 +07:00
|
|
|
customerauth.NewAuthHandler(serviceManager.AuthV2Svc, serviceManager.MemberRegistrationSvc),
|
2025-04-26 12:23:12 +07:00
|
|
|
http.NewMenuHandler(serviceManager.ProductV2Svc, serviceManager.InProgressSvc),
|
2025-05-03 10:50:41 +07:00
|
|
|
http.NewCustomerOrderHandler(serviceManager.OrderV2Svc),
|
2024-08-03 20:01:25 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, handler := range serverRoutes {
|
|
|
|
|
handler.Route(approute, authMiddleware)
|
|
|
|
|
}
|
2025-06-06 21:14:28 +07:00
|
|
|
|
|
|
|
|
http.NewCustomerUndianHandler(serviceManager.UndianSvc).Route(approute, optionlMiddleWare)
|
2024-08-03 20:01:25 +07:00
|
|
|
}
|