fix: Add revisionCount and content for document listing

Documents require:
- revisionCount >= 1 (was 0)
- content field with ProseMirror JSON structure

Without these, documents don't appear in collection sidebar.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 21:06:52 +00:00
parent b0ec9558f2
commit 114895ff56
9 changed files with 21 additions and 11 deletions

View File

@@ -244,12 +244,13 @@ const createDocument: BaseTool<CreateDocumentArgs> = {
INSERT INTO documents (
id, "urlId", title, text, "collectionId", "teamId", "parentDocumentId", "createdById",
"lastModifiedById", template, "publishedAt", "createdAt", "updatedAt", version,
"isWelcome", "fullWidth", "insightsEnabled", "collaboratorIds"
"isWelcome", "fullWidth", "insightsEnabled", "collaboratorIds", "revisionCount", content
)
VALUES (
gen_random_uuid(),
substring(md5(random()::text) from 1 for 10),
$1, $2, $3, $4, $5, $6, $7, $8, $9, NOW(), NOW(), 1, false, false, false, ARRAY[$6]::uuid[]
$1, $2, $3, $4, $5, $6, $7, $8, $9, NOW(), NOW(), 1, false, false, false, ARRAY[$6]::uuid[],
1, '{"type": "doc", "content": [{"type": "paragraph"}]}'::jsonb
)
RETURNING id, "urlId", title, "collectionId", "publishedAt", "createdAt"
`;