Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production deploy #3712

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api.planx.uk/modules/send/s3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const sendToS3 = async (req: Request, res: Response, next: NextFunction) => {

const session = await $api.session.find(sessionId);
const passport = session?.data?.passport as Passport;
const flowName = session?.flow?.name;

// Generate the ODP Schema JSON, skipping validation if not a supported application type
const doValidation = isApplicationTypeSupported(passport);
Expand All @@ -73,6 +74,7 @@ const sendToS3 = async (req: Request, res: Response, next: NextFunction) => {
},
data: {
message: "New submission from PlanX",
service: flowName,
environment: env,
file: fileUrl,
payload: doValidation ? "Validated ODP Schema" : "Discretionary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ describe("Send Slack notifications endpoint", () => {
new: {
session_id: "s3-pa-123",
team_slug: "test-team",
webhook_request: {
data: {
service: "Test flow",
message: "New submission from PlanX",
payload: "Discretionary",
environment: "Staging",
file: "api.editor.planx.dev/private/file/test",
},
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const getMessageForEventType = (data: EventData, type: EventType) => {
}

if (type === "s3-submission") {
const { session_id, team_slug } = data as S3EventData;
return `New S3 + Power Automate submission *${session_id}* [${team_slug}]`;
const { session_id, team_slug, webhook_request } = data as S3EventData;
return `New S3 + Power Automate submission "${webhook_request.data.service}" *${session_id}* [${team_slug}]`;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ export const s3SubmissionSchema = z.object({
new: z.object({
session_id: z.string(),
team_slug: z.string(),
webhook_request: z.object({
data: z.object({
message: z.string(),
service: z.string(),
environment: z.string(),
file: z.string(),
payload: z.string(),
}),
}),
}),
}),
}),
Expand Down
6 changes: 3 additions & 3 deletions api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitest/coverage-istanbul": "^2.0.5",
"@vitest/eslint-plugin": "^1.1.0",
"@vitest/ui": "^2.0.5",
"@vitest/coverage-istanbul": "^2.1.1",
"@vitest/eslint-plugin": "^1.1.4",
"@vitest/ui": "^2.1.1",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
Loading