diff --git a/src/routes/documents.js b/src/routes/documents.js index 5e473a1..a8d4a08 100644 --- a/src/routes/documents.js +++ b/src/routes/documents.js @@ -78,7 +78,7 @@ router.get('/:id', async (req, res) => { // PUT /documents/:id - Update document router.put('/:id', async (req, res) => { try { - const { title, content, tags, type, priority, status } = req.body; + const { title, content, tags, type, priority, status, folderId } = req.body; const docService = getDocumentService(); const doc = await docService.updateDocument(req.params.id, { title, @@ -87,6 +87,7 @@ router.put('/:id', async (req, res) => { type, priority, status, + folderId, }); res.json(doc); } catch (err) { diff --git a/src/services/documentService.js b/src/services/documentService.js index ba00377..c841307 100644 --- a/src/services/documentService.js +++ b/src/services/documentService.js @@ -469,7 +469,7 @@ export class DocumentService { }; } - async updateDocument(docId, { title, content, tags, type, priority, status }) { + async updateDocument(docId, { title, content, tags, type, priority, status, folderId }) { const found = this._findDocById(docId); if (!found) { throw new NotFoundError('Document'); @@ -484,6 +484,7 @@ export class DocumentService { if (priority !== undefined) meta.priority = priority; if (status !== undefined) meta.status = status; if (tags !== undefined) meta.tags = tags.filter(t => t); + if (folderId !== undefined) meta.folderId = folderId; meta.updatedAt = now; // Rewrite markdown file