feat: add basic storage usage tracking

This commit is contained in:
2025-11-02 18:12:33 +00:00
parent d2c09f5d0f
commit 9b8367ade4
8 changed files with 129 additions and 22 deletions

View File

@@ -19,12 +19,19 @@ export const authComponent = createClient<DataModel, typeof authSchema>(
user: {
onCreate: async (ctx, user) => {
const now = Date.now()
await ctx.db.insert("directories", {
name: "",
userId: user._id,
createdAt: now,
updatedAt: now,
})
await Promise.all([
ctx.db.insert("userInfo", {
userId: user._id,
storageUsageBytes: 0,
storageQuotaBytes: 1024 * 1024 * 1024 * 5, // 5GB
}),
ctx.db.insert("directories", {
name: "",
userId: user._id,
createdAt: now,
updatedAt: now,
}),
])
},
},
},