Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Sep 19, 2023
1 parent 7bdc025 commit 064a212
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 8 deletions.
35 changes: 35 additions & 0 deletions api.planx.uk/admin/session/digitalPlanningData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Request, Response, NextFunction } from "express";
import { $admin } from "../../client";

/**
* @swagger
* /admin/session/{sessionId}/digital-planning-data:
* get:
* summary: Generates a Digital Planning Data payload
* description: Generates a Digital Planning Data payload, based on the Digital Planning Data Open API schema
* tags:
* - admin
* parameters:
* - $ref: '#/components/parameters/sessionId'
* security:
* - userJWT: []
*/
export const getDigitalPlanningDataPayload = async (
req: Request,
res: Response,
next: NextFunction,
) => {
try {
const { exportData } = await $admin.export.digitalPlanningDataPayload(
req.params.sessionId,
);
res.set("content-type", "application/json");
return res.send(exportData);
} catch (error) {
return next({
message:
"Failed to make Digital Planning Data payload: " +
(error as Error).message,
});
}
};
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#4e3d09f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#f5c3ef9",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1441.0",
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api.planx.uk/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import { googleStrategy } from "./modules/auth/strategy/google";
import authRoutes from "./modules/auth/routes";
import teamRoutes from "./modules/team/routes";
import { useSwaggerDocs } from "./docs";
import { getDigitalPlanningDataPayload } from "./admin/session/digitalPlanningData";

const router = express.Router();

Expand Down Expand Up @@ -325,6 +326,10 @@ app.get("/admin/session/:sessionId/html", getHTMLExport);
app.get("/admin/session/:sessionId/html-redacted", getRedactedHTMLExport);
app.get("/admin/session/:sessionId/zip", generateZip);
app.get("/admin/session/:sessionId/summary", getSessionSummary);
app.get(
"/admin/session/:sessionId/digital-planning-data",
getDigitalPlanningDataPayload,
);

// XXX: leaving this in temporarily as a testing endpoint to ensure it
// works correctly in staging and production
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#4e3d09f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#f5c3ef9",
"axios": "^1.4.0",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#4e3d09f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#f5c3ef9",
"axios": "^1.4.0",
"dotenv": "^16.3.1",
"eslint": "^8.44.0",
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@mui/styles": "^5.14.5",
"@mui/utils": "^5.14.5",
"@opensystemslab/map": "^0.7.5",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#4e3d09f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#f5c3ef9",
"@tiptap/core": "^2.0.3",
"@tiptap/extension-bold": "^2.0.3",
"@tiptap/extension-bubble-menu": "^2.1.6",
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 064a212

Please sign in to comment.