server-ts: Fix getAttribute permitting null

This commit is contained in:
Elian Doran
2024-04-09 21:43:42 +03:00
parent b552f40ae8
commit 74441273a8
2 changed files with 2 additions and 5 deletions

View File

@@ -208,7 +208,7 @@ function createRelation(req: Request) {
const targetNoteId = req.params.targetNoteId;
const name = req.params.name;
const attributeId = sql.getValue<string | null>(`SELECT attributeId FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
const attributeId = sql.getValue<string>(`SELECT attributeId FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
let attribute = becca.getAttribute(attributeId);
if (!attribute) {