0.4.0 convex及界面修改

This commit is contained in:
liaibo
2026-02-01 08:47:40 +08:00
parent d1f055f51a
commit af92c4b149
636 changed files with 7522 additions and 1815 deletions
+53
View File
@@ -52,11 +52,19 @@ export default defineSchema({
show_structure: v.union(v.boolean(), v.null()),
protect_editing: v.union(v.boolean(), v.null()),
show_word_count: v.union(v.boolean(), v.null()),
collapse_backlinks: v.optional(v.union(v.boolean(), v.null())),
page_font: v.optional(v.union(v.literal("default"), v.literal("song"), v.literal("kai"), v.null())),
layout_density: v.optional(v.union(v.literal("compact"), v.literal("normal"), v.literal("spacious"), v.null())),
hide_child_pages: v.optional(v.union(v.boolean(), v.null())),
show_block_ref_count: v.optional(v.union(v.boolean(), v.null())),
embed_default_block_id: v.optional(v.union(v.string(), v.null())),
// 统计信息(由客户端编辑器计算后回写)
word_count: v.union(v.number(), v.null()),
character_count: v.union(v.number(), v.null()),
block_count: v.union(v.number(), v.null()),
todo_total_count: v.optional(v.union(v.number(), v.null())),
todo_done_count: v.optional(v.union(v.number(), v.null())),
// 说明:当前文档内容结构还在演进,先用 any 承接(与 Supabase Json 一致的宽松形态)。
content: v.any(),
@@ -203,6 +211,10 @@ export default defineSchema({
view_preferences: v.any(),
snapshot: v.optional(v.any()), // DocumentTableSnapshot: { rows?, luckysheet? }
is_archived: v.boolean(),
// 垃圾桶字段:与附件/思维导图的删除语义保持一致(允许历史数据缺字段)
deleted_at: v.optional(v.union(v.string(), v.null())),
deleted_by: v.optional(v.union(v.string(), v.null())),
purged_at: v.optional(v.union(v.string(), v.null())),
last_synced_at: v.optional(v.string()),
created_by: v.string(),
updated_by: v.optional(v.string()),
@@ -254,9 +266,50 @@ export default defineSchema({
.index("by_created_by", ["created_by"])
.index("by_document", ["document_id"])
.index("by_doc_user", ["document_id", "shared_with_user_id"])
.index("by_workspace", ["workspace_id"])
.index("by_workspace_shared_with", ["workspace_id", "shared_with_user_id"])
.index("by_workspace_created_by", ["workspace_id", "created_by"]),
// M9:评论(页面/块)
comment_threads: defineTable({
id: v.string(),
workspace_id: v.string(),
document_id: v.string(),
block_id: v.union(v.string(), v.null()),
resolved_at: v.union(v.string(), v.null()),
resolved_by: v.union(v.string(), v.null()),
comment_count: v.number(),
last_activity_at: v.string(),
last_comment_preview: v.union(v.string(), v.null()),
last_comment_by: v.union(v.string(), v.null()),
created_by: v.string(),
created_at: v.string(),
})
.index("by_thread_id", ["id"])
.index("by_document", ["document_id"])
.index("by_document_block", ["document_id", "block_id"])
.index("by_workspace", ["workspace_id"])
.index("by_workspace_document_activity", ["workspace_id", "document_id", "last_activity_at"]),
comment_messages: defineTable({
id: v.string(),
thread_id: v.string(),
workspace_id: v.string(),
document_id: v.string(),
block_id: v.union(v.string(), v.null()),
parent_id: v.union(v.string(), v.null()),
body: v.string(),
created_by: v.string(),
created_at: v.string(),
deleted_at: v.union(v.string(), v.null()),
deleted_by: v.union(v.string(), v.null()),
})
.index("by_message_id", ["id"])
.index("by_thread", ["thread_id"])
.index("by_document", ["document_id"])
.index("by_document_block", ["document_id", "block_id"])
.index("by_workspace", ["workspace_id"]),
groups: defineTable({
id: v.string(),
workspace_id: v.string(),