Skip to content

Commit

Permalink
run prettier in modules/webhooks too
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Jan 9, 2024
1 parent 78fe080 commit 15643c8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
33 changes: 18 additions & 15 deletions api.planx.uk/modules/webhooks/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,24 @@ export const sanitiseApplicationDataController: SanitiseApplicationData =
}
};

export const analyzeSessionsController: SanitiseApplicationData =
async (_req, res, next) => {
try {
const { operationFailed, results } = await analyzeSessions();
if (operationFailed) res.status(500);
return res.json(results);
} catch (error) {
return next(
new ServerError({
message: "Failed to update session analytics",
cause: error,
}),
);
}
};
export const analyzeSessionsController: SanitiseApplicationData = async (
_req,
res,
next,
) => {
try {
const { operationFailed, results } = await analyzeSessions();
if (operationFailed) res.status(500);
return res.json(results);
} catch (error) {
return next(
new ServerError({
message: "Failed to update session analytics",
cause: error,
}),
);
}
};

export const isCleanJSONBController: IsCleanJSONBController = async (
_req,
Expand Down
5 changes: 1 addition & 4 deletions api.planx.uk/modules/webhooks/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ router.post(
"/webhooks/hasura/sanitise-application-data",
sanitiseApplicationDataController,
);
router.post(
"/webhooks/hasura/analyze-sessions",
analyzeSessionsController,
);
router.post("/webhooks/hasura/analyze-sessions", analyzeSessionsController);
router.post(
"/webhooks/hasura/validate-input/jsonb/clean-html",
validate(isCleanJSONBSchema),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const sanitiseApplicationData = async () => {
return { operationFailed, results };
};

export const postToSlack = async (results: OperationResult[], jobName: string) => {
export const postToSlack = async (
results: OperationResult[],
jobName: string,
) => {
const slack = SlackNotify(process.env.SLACK_WEBHOOK_URL!);
const text = results.map((result) =>
result.status === "failure"
Expand Down

0 comments on commit 15643c8

Please sign in to comment.