Skip to content

Commit

Permalink
add flex role to export endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat committed Jan 15, 2024
1 parent e1dcd5d commit 7aaa4b3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions server/endpoints/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,19 @@ function systemEndpoints(app) {
}
});

app.get("/system/data-export", [validatedRequest], async (_, response) => {
try {
const { filename, error } = await exportData();
response.status(200).json({ filename, error });
} catch (e) {
console.log(e.message, e);
response.sendStatus(500).end();
app.get(
"/system/data-export",
[validatedRequest, flexUserRoleValid],
async (_, response) => {
try {
const { filename, error } = await exportData();
response.status(200).json({ filename, error });
} catch (e) {
console.log(e.message, e);
response.sendStatus(500).end();
}
}
});
);

app.get("/system/data-exports/:filename", (request, response) => {
const exportLocation = __dirname + "/../storage/exports/";
Expand Down

0 comments on commit 7aaa4b3

Please sign in to comment.