feat: add auth to convex fns

This commit is contained in:
2025-09-15 21:44:41 +00:00
parent f06064fc81
commit 8916142e04
10 changed files with 166 additions and 33 deletions

View File

@@ -3,11 +3,8 @@ import { v } from "convex/values"
const schema = defineSchema({
users: defineTable({
name: v.string(),
email: v.string(),
createdAt: v.string(),
updatedAt: v.string(),
}),
jwtSubject: v.optional(v.string()), // JWT subject from identity provider (optional for migration)
}).index("byJwtSubject", ["jwtSubject"]), // Unique index for JWT subject lookup
files: defineTable({
storageId: v.id("_storage"),
userId: v.id("users"),
@@ -20,6 +17,7 @@ const schema = defineSchema({
deletedAt: v.optional(v.string()),
})
.index("byDirectoryId", ["directoryId", "deletedAt"])
.index("byUserId", ["userId", "deletedAt"])
.index("byDeletedAt", ["deletedAt"])
.index("uniqueFileInDirectory", ["directoryId", "name", "deletedAt"]),
directories: defineTable({
@@ -30,7 +28,7 @@ const schema = defineSchema({
updatedAt: v.string(),
deletedAt: v.optional(v.string()),
})
.index("byUserId", ["userId"])
.index("byUserId", ["userId", "deletedAt"])
.index("byParentId", ["parentId", "deletedAt"])
.index("uniqueDirectoryInDirectory", ["parentId", "name", "deletedAt"]),
})