feat: add logbook title editing with E2E encryption and sync support

This commit is contained in:
2026-05-31 10:45:36 +02:00
parent b48b31580d
commit 917fb92d85
8 changed files with 291 additions and 8 deletions
+4 -4
View File
@@ -46,7 +46,7 @@ router.post('/push', async (req: any, res) => {
// Authorize: Check if logbook belongs to user
// Exception: If action is create logbook, the logbook might not exist yet,
// so we authorize based on user creating a logbook with their userId.
if (type === 'logbook' && action === 'create') {
if (type === 'logbook' && (action === 'create' || action === 'update')) {
const existing = await prisma.logbook.findUnique({
where: { id: logbookId }
})
@@ -69,9 +69,9 @@ router.post('/push', async (req: any, res) => {
},
update: {
encryptedTitle: parsed.encryptedTitle,
encryptedKey: parsed.encryptedKey || null,
iv: parsed.iv || null,
tag: parsed.tag || null,
...(parsed.encryptedKey !== undefined ? { encryptedKey: parsed.encryptedKey } : {}),
...(parsed.iv !== undefined ? { iv: parsed.iv } : {}),
...(parsed.tag !== undefined ? { tag: parsed.tag } : {}),
updatedAt: itemUpdatedAt
}
})