feat: 支持 push

This commit is contained in:
richarjiang
2025-10-11 17:38:04 +08:00
parent 999fc7f793
commit 305a969912
30 changed files with 4582 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
export interface ApnsConfig {
token: {
key: string | Buffer;
keyId: string;
teamId: string;
};
production: boolean;
clientCount?: number;
proxy?: {
host: string;
port: number;
};
connectionRetryLimit?: number;
heartBeat?: number;
requestTimeout?: number;
}
export interface ApnsNotificationOptions {
topic: string;
id?: string;
collapseId?: string;
priority?: number;
pushType?: string;
expiry?: number;
}

View File

@@ -0,0 +1,65 @@
import { PushType } from '../enums/push-type.enum';
export interface PushNotificationRequest {
userIds: string[];
title: string;
body: string;
payload?: any;
pushType?: PushType;
priority?: number;
expiry?: number;
collapseId?: string;
}
export interface PushNotificationByTemplateRequest {
userIds: string[];
templateKey: string;
data: any;
payload?: any;
}
export interface PushResult {
userId: string;
deviceToken: string;
success: boolean;
error?: string;
apnsResponse?: any;
}
export interface BatchPushResult {
totalUsers: number;
totalTokens: number;
successCount: number;
failedCount: number;
results: PushResult[];
}
export interface RenderedTemplate {
title: string;
body: string;
payload?: any;
pushType: PushType;
priority: number;
}
export interface PushStats {
totalSent: number;
totalFailed: number;
successRate: number;
averageDeliveryTime: number;
errorBreakdown: Record<string, number>;
}
export interface QueryOptions {
limit?: number;
offset?: number;
startDate?: Date;
endDate?: Date;
status?: string;
messageType?: string;
}
export interface TimeRange {
startDate: Date;
endDate: Date;
}