feat: 支持 push
This commit is contained in:
93
src/push-notifications/dto/push-response.dto.ts
Normal file
93
src/push-notifications/dto/push-response.dto.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ResponseCode } from '../../base.dto';
|
||||
|
||||
export class PushResult {
|
||||
@ApiProperty({ description: '用户ID' })
|
||||
userId: string;
|
||||
|
||||
@ApiProperty({ description: '设备令牌' })
|
||||
deviceToken: string;
|
||||
|
||||
@ApiProperty({ description: '是否成功' })
|
||||
success: boolean;
|
||||
|
||||
@ApiProperty({ description: '错误信息', required: false })
|
||||
error?: string;
|
||||
|
||||
@ApiProperty({ description: 'APNs响应', required: false })
|
||||
apnsResponse?: any;
|
||||
}
|
||||
|
||||
export class PushResponseDto {
|
||||
@ApiProperty({ description: '响应代码' })
|
||||
code: ResponseCode;
|
||||
|
||||
@ApiProperty({ description: '响应消息' })
|
||||
message: string;
|
||||
|
||||
@ApiProperty({ description: '推送结果' })
|
||||
data: {
|
||||
success: boolean;
|
||||
sentCount: number;
|
||||
failedCount: number;
|
||||
results: PushResult[];
|
||||
};
|
||||
}
|
||||
|
||||
export class BatchPushResponseDto {
|
||||
@ApiProperty({ description: '响应代码' })
|
||||
code: ResponseCode;
|
||||
|
||||
@ApiProperty({ description: '响应消息' })
|
||||
message: string;
|
||||
|
||||
@ApiProperty({ description: '批量推送结果' })
|
||||
data: {
|
||||
totalUsers: number;
|
||||
totalTokens: number;
|
||||
successCount: number;
|
||||
failedCount: number;
|
||||
results: PushResult[];
|
||||
};
|
||||
}
|
||||
|
||||
export class RegisterTokenResponseDto {
|
||||
@ApiProperty({ description: '响应代码' })
|
||||
code: ResponseCode;
|
||||
|
||||
@ApiProperty({ description: '响应消息' })
|
||||
message: string;
|
||||
|
||||
@ApiProperty({ description: '注册结果' })
|
||||
data: {
|
||||
success: boolean;
|
||||
tokenId: string;
|
||||
};
|
||||
}
|
||||
|
||||
export class UpdateTokenResponseDto {
|
||||
@ApiProperty({ description: '响应代码' })
|
||||
code: ResponseCode;
|
||||
|
||||
@ApiProperty({ description: '响应消息' })
|
||||
message: string;
|
||||
|
||||
@ApiProperty({ description: '更新结果' })
|
||||
data: {
|
||||
success: boolean;
|
||||
tokenId: string;
|
||||
};
|
||||
}
|
||||
|
||||
export class UnregisterTokenResponseDto {
|
||||
@ApiProperty({ description: '响应代码' })
|
||||
code: ResponseCode;
|
||||
|
||||
@ApiProperty({ description: '响应消息' })
|
||||
message: string;
|
||||
|
||||
@ApiProperty({ description: '注销结果' })
|
||||
data: {
|
||||
success: boolean;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user