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:
@@ -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,
|
||||
}),
|
||||
])
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user