48 lines
890 B
TypeScript
48 lines
890 B
TypeScript
import { IsEnum, IsOptional, IsString, IsUUID } from 'class-validator';
|
|
import type { SharePlatform } from './analytics.entity';
|
|
|
|
export class TrackShareDto {
|
|
@IsUUID()
|
|
articleId: string;
|
|
|
|
@IsEnum(['facebook', 'twitter', 'whatsapp', 'telegram', 'link'])
|
|
platform: SharePlatform;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
userAgent?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
ipAddress?: string;
|
|
}
|
|
|
|
export class GetShareStatsDto {
|
|
@IsOptional()
|
|
@IsUUID()
|
|
articleId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
startDate?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
endDate?: string;
|
|
}
|
|
|
|
export class ShareStatsResponse {
|
|
articleId: string;
|
|
articleTitle: string;
|
|
facebookShares: number;
|
|
twitterShares: number;
|
|
whatsappShares: number;
|
|
telegramShares: number;
|
|
linkShares: number;
|
|
totalShares: number;
|
|
views: number;
|
|
shareRate: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|