refactor: unify mock/real dir content table

This commit is contained in:
2025-12-18 01:24:35 +00:00
parent a620e0248a
commit 68f9b84da3
5 changed files with 276 additions and 686 deletions

View File

@@ -91,10 +91,32 @@ type DirectoryContentQueryParams = {
limit: number
}
type DirectoryContentPageParam = {
orderBy: DirectoryContentOrderBy
direction: DirectoryContentOrderDirection
limit: number
cursor: string
}
const directoryContentQueryKey = (
accountId: string | undefined,
directoryId: string,
) => ["accounts", accountId, "directories", directoryId, "content"]
): readonly (string | undefined)[] => [
"accounts",
accountId,
"directories",
directoryId,
"content",
]
export type DirectoryContentQuery = ReturnType<
typeof infiniteQueryOptions<
typeof DirectoryContentResponse.infer,
Error,
InfiniteData<typeof DirectoryContentResponse.infer>,
readonly (string | undefined)[],
DirectoryContentPageParam
>
>
export const directoryContentQueryAtom = atomFamily(
({ directoryId, orderBy, direction, limit }: DirectoryContentQueryParams) =>
atom((get) => {