chore: sync service

This commit is contained in:
mahyargdz
2025-07-12 15:35:39 +03:30
parent 7177a13e94
commit 7a0c337cda
2 changed files with 307 additions and 44 deletions
@@ -1,39 +1,79 @@
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
export class QuotaStatisticsDto {
@ApiProperty({ description: "Total number of email users", example: 150 })
totalUsers: number;
@ApiProperty({ description: "Total quota used by all users in bytes", example: 5368709120 })
totalQuotaUsed: number;
@ApiProperty({ description: "Total quota allowed for all users in bytes", example: 21474836480 })
totalQuotaAllowed: number;
@ApiProperty({ description: "Average quota usage percentage", example: 25.0 })
averageUsagePercent: number;
@ApiPropertyOptional({
description: "Last time quota was synced",
example: "2024-01-15T10:30:00Z",
type: String,
format: "date-time",
})
lastSyncTime: Date | null;
}
import { ApiProperty } from "@nestjs/swagger";
export class QuotaInfoDto {
@ApiProperty({ description: "Quota used in bytes", example: 1073741824 })
@ApiProperty({ description: "Used quota in bytes", example: 67108864 })
used: number;
@ApiProperty({ description: "Quota allowed in bytes", example: 5368709120 })
@ApiProperty({ description: "Allowed quota in bytes", example: 134217728 })
allowed: number;
}
export class SyncResultDto {
@ApiProperty({ description: "Number of successfully synced users", example: 145 })
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 users with sync errors", example: 5 })
@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;
}