0.1.07 文件树拖拽与多思维导图
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
import type { SupabaseClient } from "@supabase/supabase-js";
|
||||
import type { Database } from "@/types/supabase";
|
||||
|
||||
type TypedClient = SupabaseClient<Database>;
|
||||
type TypedClient = SupabaseClient<any>;
|
||||
|
||||
interface WorkspaceMembershipRow {
|
||||
workspace_id: string;
|
||||
is_default: boolean;
|
||||
workspaces: {
|
||||
id: string;
|
||||
name: string;
|
||||
type: "personal" | "team";
|
||||
icon_url: string | null;
|
||||
} | null;
|
||||
workspaces:
|
||||
| {
|
||||
id: string;
|
||||
name: string;
|
||||
type: "personal" | "team";
|
||||
icon_url: string | null;
|
||||
}
|
||||
| Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
type: "personal" | "team";
|
||||
icon_url: string | null;
|
||||
}>
|
||||
| null;
|
||||
}
|
||||
|
||||
export interface WorkspaceSummary {
|
||||
@@ -80,7 +87,7 @@ export async function fetchWorkspaceSummaries(
|
||||
throw new Error(`拉取工作空间列表失败:${error.message}`);
|
||||
}
|
||||
|
||||
const rows: WorkspaceMembershipRow[] = memberRows ?? [];
|
||||
const rows: WorkspaceMembershipRow[] = (memberRows ?? []) as any;
|
||||
const workspaceIds = rows.map((row) => row.workspace_id);
|
||||
|
||||
const memberCountMap: Record<string, number> = {};
|
||||
@@ -102,15 +109,16 @@ export async function fetchWorkspaceSummaries(
|
||||
|
||||
const summaries: WorkspaceSummary[] = rows
|
||||
.map((row) => {
|
||||
if (!row.workspaces) {
|
||||
const workspace = Array.isArray(row.workspaces) ? row.workspaces[0] : row.workspaces;
|
||||
if (!workspace) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
id: row.workspaces.id,
|
||||
name: row.workspaces.name,
|
||||
type: row.workspaces.type,
|
||||
iconUrl: row.workspaces.icon_url,
|
||||
memberCount: memberCountMap[row.workspaces.id] ?? 1,
|
||||
id: workspace.id,
|
||||
name: workspace.name,
|
||||
type: workspace.type,
|
||||
iconUrl: workspace.icon_url,
|
||||
memberCount: memberCountMap[workspace.id] ?? 1,
|
||||
isDefault: row.is_default,
|
||||
} satisfies WorkspaceSummary;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user