refactor: top level dir + moved route

create a root directory entry in table for each user and move file browser under /directories/$id
This commit is contained in:
2025-09-19 23:01:44 +00:00
parent 9fbd5e678a
commit 4812fcc0a2
15 changed files with 1047 additions and 25 deletions

View File

@@ -26,6 +26,21 @@ export const fetchFiles = authenticatedQuery({
},
})
export const fetchRootDirectory = authenticatedQuery({
handler: async (ctx) => {
return await Directories.fetchRoot(ctx)
},
})
export const fetchDirectory = authenticatedQuery({
args: {
directoryId: v.id("directories"),
},
handler: async (ctx, { directoryId }) => {
return await Directories.fetch(ctx, { directoryId })
},
})
export const fetchDirectoryContent = authenticatedQuery({
args: {
directoryId: v.optional(v.id("directories")),
@@ -39,7 +54,7 @@ export const fetchDirectoryContent = authenticatedQuery({
export const createDirectory = authenticatedMutation({
args: {
name: v.string(),
directoryId: v.optional(v.id("directories")),
directoryId: v.id("directories"),
},
handler: async (ctx, { name, directoryId }): Promise<Id<"directories">> => {
return await Directories.create(ctx, {