Skip to content

Commit

Permalink
ISOM-1147: feat: read folder dto (#154)
Browse files Browse the repository at this point in the history
* added read folder dto

* Made explicit that the endpoint can read both folder and top level folder content

* Fix typo
  • Loading branch information
hanpuliu-charles authored Jun 14, 2024
1 parent 73a032c commit b077cf3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/studio/src/schemas/folder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { z } from 'zod'

export const readFolderOrTopLevelFolderSchema = z.object({
// Null resourceId indicates reading of top level folder in a site.
siteId: z.string(),
resourceId: z.string().nullable()
})
17 changes: 17 additions & 0 deletions apps/studio/src/server/modules/folder/folder.router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { readFolderOrTopLevelFolderSchema } from "~/schemas/folder";
import { protectedProcedure, router } from '~/server/trpc'


export const folderRouter = router({
readFolderOrTopLevelFolder: protectedProcedure.input(readFolderOrTopLevelFolderSchema).query(async ({ input, ctx }) => {
// TODO: Fill these in later
const folderName: string = ""
const children: {id: string, name: string, type: 'page' | 'folder'}[] = []
// Not sure if a backpointer is needed here
const parentId: string = ""
return {
folderName, children, parentId
}
})

})
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b077cf3

Please sign in to comment.