mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[misc] add a new endpoint for changing a docs meta data -- incl. deleted
- Validate the request payload with joi -- includes acceptance tests. - Reject updates to docs that have been deleted.
This commit is contained in:
@@ -188,6 +188,17 @@ module.exports = HttpController = {
|
||||
})
|
||||
},
|
||||
|
||||
patchDoc(req, res, next) {
|
||||
const { project_id, doc_id } = req.params
|
||||
logger.log({ project_id, doc_id }, 'patching doc')
|
||||
DocManager.patchDoc(project_id, doc_id, req.body, function (error) {
|
||||
if (error) {
|
||||
return next(error)
|
||||
}
|
||||
res.sendStatus(204)
|
||||
})
|
||||
},
|
||||
|
||||
_buildDocView(doc) {
|
||||
const doc_view = { _id: doc._id != null ? doc._id.toString() : undefined }
|
||||
for (const attribute of ['lines', 'rev', 'version', 'ranges', 'deleted']) {
|
||||
|
||||
Reference in New Issue
Block a user