ETAPI openapi spec WIP

This commit is contained in:
zadam
2022-01-07 23:06:04 +01:00
parent d74371c9f5
commit 2532ea525d
6 changed files with 458 additions and 49 deletions

View File

@@ -15,7 +15,7 @@ function register(router) {
ru.route(router, 'get', '/etapi/notes/:noteId/content', (req, res, next) => {
const note = ru.getAndCheckNote(req.params.noteId);
const filename = utils.formatDownloadTitle(note.title, note.type, note.mime);
res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
@@ -52,13 +52,13 @@ function register(router) {
ru.route(router, 'patch' ,'/etapi/notes/:noteId', (req, res, next) => {
const note = ru.getAndCheckNote(req.params.noteId)
if (note.isProtected) {
throw new ru.EtapiError(404, "NOTE_IS_PROTECTED", `Note ${req.params.noteId} is protected and cannot be modified through ETAPI`);
throw new ru.EtapiError(400, "NOTE_IS_PROTECTED", `Note '${req.params.noteId}' is protected and cannot be modified through ETAPI`);
}
ru.validateAndPatch(note, req.body, ALLOWED_PROPERTIES_FOR_PATCH);
res.json(mappers.mapNoteToPojo(note));
});
@@ -79,4 +79,4 @@ function register(router) {
module.exports = {
register
};
};