0.3 增加登录模块
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
import { defineSchema, defineTable } from "convex/server";
|
||||
import { v } from "convex/values";
|
||||
import { authTables } from "@convex-dev/auth/server";
|
||||
|
||||
// 说明:
|
||||
// - 这里先按“兼容现有 Next API 返回结构”的思路设计字段:id/workspace_id/user_id 等命名保持与 Supabase 一致。
|
||||
// - 这里先按"兼容现有 Next API 返回结构"的思路设计字段:id/workspace_id/user_id 等命名保持与 Supabase 一致。
|
||||
// - Convex 自带的 _id 仍然存在,但我们暂时不把它暴露给上层业务,便于逐步迁移与回退。
|
||||
// - M8: 集成 Convex Auth,authTables 提供用户认证所需的数据表
|
||||
|
||||
export default defineSchema({
|
||||
// Convex Auth 表(用户、账户、会话等)
|
||||
...authTables,
|
||||
workspaces: defineTable({
|
||||
id: v.string(),
|
||||
name: v.string(),
|
||||
@@ -187,4 +191,50 @@ export default defineSchema({
|
||||
.index("by_workspace_target", ["workspace_id", "target_page_id"])
|
||||
.index("by_workspace_source", ["workspace_id", "source_page_id"])
|
||||
.index("by_unique", ["workspace_id", "source_page_id", "source_block_id", "target_page_id", "display_mode"]),
|
||||
|
||||
// M5:在线表格(替代 Supabase document_tables)
|
||||
document_tables: defineTable({
|
||||
id: v.string(),
|
||||
workspace_id: v.string(),
|
||||
document_id: v.string(),
|
||||
grid_key: v.string(),
|
||||
title: v.string(),
|
||||
schema: v.any(), // TableSchema: { columns, frozenRowCount, frozenColCount }
|
||||
view_preferences: v.any(),
|
||||
snapshot: v.optional(v.any()), // DocumentTableSnapshot: { rows?, luckysheet? }
|
||||
is_archived: v.boolean(),
|
||||
last_synced_at: v.optional(v.string()),
|
||||
created_by: v.string(),
|
||||
updated_by: v.optional(v.string()),
|
||||
created_at: v.string(),
|
||||
updated_at: v.string(),
|
||||
})
|
||||
.index("by_table_id", ["id"])
|
||||
.index("by_grid_key", ["grid_key"])
|
||||
.index("by_document", ["document_id"])
|
||||
.index("by_workspace", ["workspace_id"])
|
||||
.index("by_workspace_archived", ["workspace_id", "is_archived"]),
|
||||
|
||||
// M5:在线表格行数据(替代 Supabase document_table_rows)
|
||||
document_table_rows: defineTable({
|
||||
id: v.string(),
|
||||
workspace_id: v.string(),
|
||||
document_id: v.string(),
|
||||
table_id: v.string(),
|
||||
row_index: v.number(),
|
||||
row_data: v.any(),
|
||||
row_hash: v.optional(v.string()),
|
||||
is_deleted: v.boolean(),
|
||||
updated_by: v.optional(v.string()),
|
||||
created_at: v.string(),
|
||||
updated_at: v.string(),
|
||||
})
|
||||
.index("by_row_id", ["id"])
|
||||
.index("by_table", ["table_id"])
|
||||
.index("by_table_row", ["table_id", "row_index"])
|
||||
.index("by_workspace", ["workspace_id"])
|
||||
.searchIndex("by_table_row_full", {
|
||||
searchField: "row_hash",
|
||||
filterFields: ["table_id", "is_deleted"],
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user