feat: Add by_owner index to the projects table, remove redundant query filter, and update isAuthenticated export.

This commit is contained in:
2026-02-03 18:59:55 +00:00
parent be7db36126
commit eff3316480
3 changed files with 14 additions and 3 deletions

View File

@@ -9,8 +9,7 @@ export const getProjects = query({
if (!userId) return [];
return await ctx.db
.query("projects")
.withIndex("by_owner", (q) => q.eq("userId", userId)) // Note: Need to add index to schema too? Or just filter? Schema doesn't define indexes yet. Will rely on filter for now or filter in memory if small. Actually, will rely on simple filter or add index later.
.filter((q) => q.eq(q.field("userId"), userId))
.withIndex("by_owner", (q) => q.eq("userId", userId))
.collect();
},
});