Add API endpoint for patching a project

This commit is contained in:
D. Berge
2023-08-30 13:47:02 +02:00
parent b4f23822c4
commit 6721b1b96b
6 changed files with 108 additions and 3 deletions

View File

@@ -98,6 +98,7 @@ app.map({
},
'/project/:project/configuration': {
get: [ mw.auth.access.write, mw.project.configuration.get ], // Get project configuration
patch: [ mw.auth.access.write, mw.project.configuration.patch ], // Modify project configuration
},
/*

View File

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

View File

@@ -0,0 +1,16 @@
const { project } = require('../../../../lib/db');
module.exports = async function (req, res, next) {
try {
// TODO
// Implement If-Match header requirements
res.send(await project.configuration.patch(req.params.project, req.body));
next();
} catch (err) {
next(err);
}
};