server-ts: Convert etapi/notes

This commit is contained in:
Elian Doran
2024-04-07 16:56:45 +03:00
parent e4024408bd
commit 5fdf094e9d
8 changed files with 95 additions and 55 deletions

View File

@@ -20,6 +20,13 @@ function updateFile(req: AppRequest) {
const note = becca.getNoteOrThrow(req.params.noteId);
const file = req.file;
if (!file) {
return {
uploaded: false,
message: `Missing file.`
};
}
note.saveRevision();
note.mime = file.mimetype.toLowerCase();
@@ -39,6 +46,12 @@ function updateFile(req: AppRequest) {
function updateAttachment(req: AppRequest) {
const attachment = becca.getAttachmentOrThrow(req.params.attachmentId);
const file = req.file;
if (!file) {
return {
uploaded: false,
message: `Missing file.`
};
}
attachment.getNote().saveRevision();