feat: storage and token limiting

This commit is contained in:
Vasily Zubarev
2025-04-21 13:50:45 +02:00
parent 62bad46e58
commit 73e83221b8
25 changed files with 232 additions and 65 deletions

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "users" ADD COLUMN "storage_limit" INTEGER DEFAULT -1;

View File

@@ -0,0 +1,12 @@
/*
Warnings:
- Made the column `storage_used` on table `users` required. This step will fail if there are existing NULL values in that column.
- Made the column `token_balance` on table `users` required. This step will fail if there are existing NULL values in that column.
- Made the column `storage_limit` on table `users` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "users" ALTER COLUMN "storage_used" SET NOT NULL,
ALTER COLUMN "token_balance" SET NOT NULL,
ALTER COLUMN "storage_limit" SET NOT NULL;

View File

@@ -27,8 +27,9 @@ model User {
membershipPlan String? @map("membership_plan")
membershipExpiresAt DateTime? @map("membership_expires_at")
emailVerified Boolean @default(false) @map("is_email_verified")
storageUsed Int? @default(0) @map("storage_used")
tokenBalance Int? @default(0) @map("token_balance")
storageUsed Int @default(0) @map("storage_used")
storageLimit Int @default(-1) @map("storage_limit")
tokenBalance Int @default(0) @map("token_balance")
accounts Account[]
sessions Session[]