Add API endpoint to retrieve project configuration.

Only available to users with at least `write` access.
This commit is contained in:
D. Berge
2023-08-23 19:22:07 +02:00
parent 1a6500308f
commit 38a07dffc6
4 changed files with 25 additions and 0 deletions

View File

@@ -95,6 +95,9 @@ app.map({
'/project/:project/summary': {
get: [ mw.project.summary.get ],
},
'/project/:project/configuration': {
get: [ mw.auth.access.write, mw.project.configuration.get ], // Get project configuration
},
/*
* GIS endpoints

View File

@@ -0,0 +1,13 @@
const { project } = require('../../../../lib/db');
module.exports = async function (req, res, next) {
try {
res.status(200).send(await project.configuration.get(req.params.project));
next();
} catch (err) {
next(err);
}
};

View File

@@ -0,0 +1,8 @@
module.exports = {
get: require('./get'),
// post: require('./post'),
// put: require('./put'),
// patch: require('./patch'),
// delete: require('./delete'),
};

View File

@@ -2,4 +2,5 @@ module.exports = {
get: require('./get'),
post: require('./post'),
summary: require('./summary'),
configuration: require('./configuration'),
};