Skip to content

Commit

Permalink
update shared-routes and use new onInputValidationError function
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Oct 28, 2024
1 parent 948bdaf commit b4d501c
Show file tree
Hide file tree
Showing 5 changed files with 796 additions and 655 deletions.
2 changes: 1 addition & 1 deletion back/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"querystring": "^0.2.1",
"ramda": "^0.30.1",
"shared": "workspace:*",
"shared-routes": "^0.8.19",
"shared-routes": "^0.8.23",
"ts-node": "^10.9.1",
"ts-pattern": "4.2.2",
"uuid": "^8.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import type { AppDependencies } from "../../../../config/bootstrap/createAppDepe
import { sendHttpResponse } from "../../../../config/helpers/sendHttpResponse";
import { sendRedirectResponse } from "../../../../config/helpers/sendRedirectResponse";
import { UploadFileInput } from "../../../../domains/core/file-storage/useCases/UploadFile";
import { createLogger } from "../../../../utils/logger";
import { createOpenApiSpecV2 } from "../apiKeyAuthRouter/createOpenApiV2";

const logger = createLogger(__filename);

export const createTechnicalRouter = (
deps: AppDependencies,
inboundEmailAllowIps: string[],
Expand All @@ -35,6 +38,19 @@ export const createTechnicalRouter = (
const technicalSharedRouter = createExpressSharedRouter(
technicalRoutes,
technicalRouter,
{
onInputValidationError: (zodError, route) => {
if (route.url === technicalRoutes.inboundEmailParsing.url) {
logger.error({
message: `Inbound email parsing failed : ${route.method.toUpperCase()} ${
route.url
}`,
error: zodError,
});
}
return zodError;
},
},
);

technicalSharedRouter.inboundEmailParsing(
Expand Down
2 changes: 1 addition & 1 deletion front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"sass": "^1.55.0",
"scss-mapper": "workspace:*",
"shared": "workspace:*",
"shared-routes": "^0.8.19",
"shared-routes": "^0.8.23",
"swagger-ui-react": "^5.1.0",
"ts-pattern": "^5.0.0",
"tss-react": "^4.5.2",
Expand Down
Loading

0 comments on commit b4d501c

Please sign in to comment.