feat(billing): cap each owner's stored file volume

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-02 15:44:36 +03:30
co-authored by Cursor
parent e6e90aabf3
commit 28938e8f77
20 changed files with 647 additions and 22 deletions
+19
View File
@@ -54,6 +54,8 @@ export interface AuthUserDto {
enabledModules?: OrgModuleKey[];
/** خلاصه اشتراک مالک محیط (برای اعضا فقط جهت نمایش/گیت ورود) */
subscription?: SubscriptionSummaryDto | null;
/** حجم فایل اشتراک مالک همین محیط */
storage?: StorageUsageDto | null;
/** اگر باشد، این کاربر سوئیچ «بایگانی اطلاعات قبل» را دارد */
priorArchive?: { lens: "current" | "archive"; cutoffAt: string | null } | null;
/**
@@ -333,6 +335,22 @@ export function defaultEnabledModules(): OrgModuleKey[] {
return ORG_MODULE_KEYS.filter((k) => !OPT_IN_ORG_MODULES.includes(k));
}
export type StorageUsageLevel = "ok" | "warn" | "full" | "unlimited";
/** حجم فایل اشتراک مالک. quotaBytes خالی یعنی سقفی گذاشته نشده. */
export interface StorageUsageDto {
usedBytes: number;
quotaBytes: number | null;
percent: number | null;
level: StorageUsageLevel;
byOrganization?: Array<{ id: string; name: string; usedBytes: number }>;
}
export interface SetStorageQuotaRequest {
/** گیگابایت؛ null یعنی بدون سقف */
quotaGb: number | null;
}
export interface SubscriptionSummaryDto {
planCode: BillingPlanCode;
status: BillingAccountStatus;
@@ -355,6 +373,7 @@ export interface BillingAccountDto {
notes?: string | null;
daysRemaining: number;
warn: boolean;
storage?: StorageUsageDto | null;
}
export interface ApplyBillingPlanRequest {