Skip to content

Commit

Permalink
allow setting image labels in sender API
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Dec 19, 2021
1 parent 2ff6e50 commit 20465a4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/routes/api/sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ function uploadImage(req) {

const parentNote = dateNoteService.getDateNote(req.headers['x-local-date']);

const {noteId} = imageService.saveImage(parentNote.noteId, file.buffer, originalName, true);
const {note, noteId} = imageService.saveImage(parentNote.noteId, file.buffer, originalName, true);

const labelsStr = req.headers['x-labels'];

if (labelsStr?.trim()) {
const labels = JSON.parse(labelsStr);

for (const {name, value} of labels) {
note.setLabel(attributeService.sanitizeAttributeName(name), value);
}
}

return {
noteId: noteId
Expand Down

0 comments on commit 20465a4

Please sign in to comment.