chore(lint): improve type and get rid of "any"

This commit is contained in:
Panagiotis Papadopoulos
2025-03-06 22:44:54 +01:00
parent 0f0e55deb2
commit dfb8982a99
2 changed files with 4 additions and 2 deletions

View File

@@ -33,7 +33,9 @@ function getAllAttachments(req: Request) {
function saveAttachment(req: Request) {
const { noteId } = req.params;
const { attachmentId, role, mime, title, content } = req.body;
const { matchBy } = req.query as any;
const matchByQuery = req.query.matchBy
const isValidMatchBy = (typeof matchByQuery === "string") && (matchByQuery === "attachmentId" || matchByQuery === "title");
const matchBy = isValidMatchBy ? matchByQuery : undefined;
const note = becca.getNoteOrThrow(noteId);
note.saveAttachment({ attachmentId, role, mime, title, content }, matchBy);