Files
dmail-api/src/modules/quota-sync/DTO/quota-statistics.dto.ts
T
2025-07-12 15:35:39 +03:30

80 lines
2.7 KiB
TypeScript

import { ApiProperty } from "@nestjs/swagger";
export class QuotaInfoDto {
@ApiProperty({ description: "Used quota in bytes", example: 67108864 })
used: number;
@ApiProperty({ description: "Allowed quota in bytes", example: 134217728 })
allowed: number;
}
export class BusinessQuotaInfoDto {
@ApiProperty({ description: "Business ID", example: "12345678-1234-1234-1234-123456789012" })
businessId: string;
@ApiProperty({ description: "Business name", example: "Acme Corp" })
businessName: string;
@ApiProperty({ description: "Total quota allocated in bytes", example: 1073741824 })
totalQuota: number;
@ApiProperty({ description: "Used quota in bytes", example: 536870912 })
usedQuota: number;
@ApiProperty({ description: "Remaining quota in bytes", example: 536870912 })
remainingQuota: number;
@ApiProperty({ description: "Number of users in this business", example: 5 })
userCount: number;
}
export class UserQuotaStatisticsDto {
@ApiProperty({ description: "Total number of users", example: 150 })
totalUsers: number;
@ApiProperty({ description: "Total quota used across all users in bytes", example: 10737418240 })
totalQuotaUsed: number;
@ApiProperty({ description: "Total quota allowed across all users in bytes", example: 21474836480 })
totalQuotaAllowed: number;
@ApiProperty({ description: "Average usage percentage", example: 50.0 })
averageUsagePercent: number;
@ApiProperty({ description: "Last sync time", example: "2024-01-15T10:30:00Z", nullable: true })
lastSyncTime: Date | null;
}
export class BusinessQuotaStatisticsDto {
@ApiProperty({ description: "Total number of businesses", example: 10 })
totalBusinesses: number;
@ApiProperty({ description: "Total quota allocated across all businesses in bytes", example: 10737418240 })
totalQuotaAllocated: number;
@ApiProperty({ description: "Total quota used across all businesses in bytes", example: 5368709120 })
totalQuotaUsed: number;
@ApiProperty({ description: "Average usage percentage", example: 50.0 })
averageUsagePercent: number;
@ApiProperty({ description: "Detailed information for each business", type: [BusinessQuotaInfoDto] })
businesses: BusinessQuotaInfoDto[];
}
export class QuotaSyncResultDto {
@ApiProperty({ description: "Number of successful syncs", example: 100 })
success: number;
@ApiProperty({ description: "Number of failed syncs", example: 2 })
errors: number;
}
export class ComprehensiveQuotaSyncResultDto {
@ApiProperty({ description: "User sync results", type: QuotaSyncResultDto })
userSync: QuotaSyncResultDto;
@ApiProperty({ description: "Business sync results", type: QuotaSyncResultDto })
businessSync: QuotaSyncResultDto;
}