mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-01 14:01:40 +00:00
feat: basic recent file browsing
This commit is contained in:
@@ -265,3 +265,19 @@ export async function openFile(
|
||||
shareToken: newFileShare.shareToken,
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchRecentFiles(
|
||||
ctx: AuthenticatedQueryCtx,
|
||||
{ limit }: { limit: number },
|
||||
) {
|
||||
return await ctx.db
|
||||
.query("files")
|
||||
.withIndex("byLastAccessedAt", (q) =>
|
||||
q
|
||||
.eq("userId", ctx.user._id)
|
||||
.eq("deletedAt", undefined)
|
||||
.gte("lastAccessedAt", 0),
|
||||
)
|
||||
.order("desc")
|
||||
.take(limit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user