mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-01 05:51:39 +00:00
feat: add basic storage usage tracking
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { MutationCtx, QueryCtx } from "@fileone/convex/server"
|
||||
import type { Doc } from "../_generated/dataModel"
|
||||
import { authComponent } from "../auth"
|
||||
import { type AuthenticatedQueryCtx, authorizedGet } from "../functions"
|
||||
import * as Err from "../shared/error"
|
||||
|
||||
export type AuthUser = Awaited<ReturnType<typeof authComponent.getAuthUser>>
|
||||
@@ -23,3 +25,10 @@ export async function userOrThrow(ctx: QueryCtx | MutationCtx) {
|
||||
const user = await authComponent.getAuthUser(ctx)
|
||||
return user
|
||||
}
|
||||
|
||||
export async function queryInfo(ctx: AuthenticatedQueryCtx) {
|
||||
return await ctx.db
|
||||
.query("userInfo")
|
||||
.withIndex("byUserId", (q) => q.eq("userId", ctx.user._id))
|
||||
.first()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user