用户生成资源容量管控

This commit is contained in:
2026-06-29 13:50:39 +08:00
parent b21f35582e
commit 25fa41f894
21 changed files with 1314 additions and 80 deletions
+39
View File
@@ -7,6 +7,7 @@ export interface User {
isAdmin: boolean;
userType: string;
allowedMenus?: string[] | null;
resourceCapacity?: ResourceCapacityUsage | null;
}
export interface CreditRecord {
@@ -93,6 +94,43 @@ export interface LoginParams {
password: string;
}
export type ResourceCapacityUnit = 'MB' | 'GB' | 'TB';
export type ResourceCapacitySource = 'user' | 'global' | 'disabled';
export interface ResourceCapacityUsage {
enabled: boolean;
source: ResourceCapacitySource;
hasUserConfig: boolean;
usedBytes: number;
availableBytes: number | null;
totalBytes: number | null;
usagePercent: number | null;
exceeded: boolean;
limitValue: string | null;
limitUnit: ResourceCapacityUnit | null;
}
export interface ResourceCapacityConfigOut {
enabled: boolean;
limitValue: string;
limitUnit: ResourceCapacityUnit;
limitBytes: number;
}
export interface ResourceCapacityConfigPayload {
enabled: boolean;
limitValue?: string | number | null;
limitUnit?: ResourceCapacityUnit | null;
}
export interface AdminUserResourceCapacityOut {
hasUserConfig: boolean;
userConfig: ResourceCapacityConfigOut | null;
globalConfig: ResourceCapacityConfigOut;
effective: ResourceCapacityUsage;
}
// ── Admin Types ──────────────────────────────────────
export interface AdminUser {
@@ -108,6 +146,7 @@ export interface AdminUser {
createdAt: string;
lastLoginAt?: string;
allowedMenus?: string[] | null;
resourceCapacity?: ResourceCapacityUsage | null;
}
export interface AdminStats {