feat(push): migrate APNs provider from @parse/node-apn to apns2 library
- Replace @parse/node-apn with apns2 for improved APNs integration - Update ApnsProvider to use new ApnsClient with modern API - Refactor notification creation and sending logic for better error handling - Add proper error event listeners for device token issues - Update configuration interface to match apns2 requirements - Modify push notification endpoints to allow public access for token registration - Update service methods to handle new response format from apns2 - Add UsersModule dependency to PushNotificationsModule
This commit is contained in:
@@ -18,7 +18,7 @@ export class PushTokenService {
|
||||
/**
|
||||
* 注册设备令牌
|
||||
*/
|
||||
async registerToken(userId: string, tokenData: RegisterDeviceTokenDto): Promise<UserPushToken> {
|
||||
async registerToken(tokenData: RegisterDeviceTokenDto, userId?: string): Promise<UserPushToken> {
|
||||
try {
|
||||
this.logger.log(`Registering push token for user ${userId}`);
|
||||
|
||||
@@ -45,13 +45,6 @@ export class PushTokenService {
|
||||
return existingToken;
|
||||
}
|
||||
|
||||
// 检查用户是否已有其他设备的令牌,可以选择是否停用旧令牌
|
||||
const userTokens = await this.pushTokenModel.findAll({
|
||||
where: {
|
||||
userId,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
// 创建新令牌
|
||||
const newToken = await this.pushTokenModel.create({
|
||||
|
||||
Reference in New Issue
Block a user