feat(push): 新增设备推送和测试功能

- 新增基于设备令牌的推送通知接口
- 添加推送测试服务,支持应用启动时自动测试
- 新增推送测试文档说明
- 更新 APNS 配置和日志记录
- 迁移至 apns2 库的 PushType 枚举
- 替换订阅密钥文件
- 添加项目规则文档
This commit is contained in:
richarjiang
2025-10-15 19:09:51 +08:00
parent 38dd740c8c
commit cc83b84c80
20 changed files with 728 additions and 37 deletions

View File

@@ -0,0 +1,51 @@
import { ApiProperty } from '@nestjs/swagger';
import { ResponseCode } from '../../base.dto';
export class DevicePushResult {
@ApiProperty({ description: '设备令牌' })
deviceToken: string;
@ApiProperty({ description: '用户ID可选如果可获取' })
userId?: string;
@ApiProperty({ description: '是否成功' })
success: boolean;
@ApiProperty({ description: '错误信息', required: false })
error?: string;
@ApiProperty({ description: 'APNs响应', required: false })
apnsResponse?: any;
}
export class DevicePushResponseDto {
@ApiProperty({ description: '响应代码' })
code: ResponseCode;
@ApiProperty({ description: '响应消息' })
message: string;
@ApiProperty({ description: '推送结果' })
data: {
success: boolean;
sentCount: number;
failedCount: number;
results: DevicePushResult[];
};
}
export class BatchDevicePushResponseDto {
@ApiProperty({ description: '响应代码' })
code: ResponseCode;
@ApiProperty({ description: '响应消息' })
message: string;
@ApiProperty({ description: '批量推送结果' })
data: {
totalTokens: number;
successCount: number;
failedCount: number;
results: DevicePushResult[];
};
}