logs removed
This commit is contained in:
1 parent
57864e00da
commit
d041575600
7 files changed
+18
-101
No files matched your search
@@ -30,12 +30,6 @@ export class PushController {
|
||||
@Post('subscribe')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
async subscribe(@Body() dto: SubscribeDto): Promise<{ success: boolean }> {
|
||||
console.log('Received push subscription:', {
|
||||
endpoint: dto.endpoint?.substring(0, 50) + '...',
|
||||
hasP256dh: !!dto.p256dh,
|
||||
hasAuth: !!dto.auth,
|
||||
userId: dto.userId,
|
||||
});
|
||||
await this.pushService.subscribe(dto);
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@@ -49,15 +49,11 @@ export class PushService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async subscribe(dto: SubscribeDto): Promise<PushSubscriptionEntity> {
|
||||
this.logger.log('Subscribing push notification...');
|
||||
this.logger.debug(`Endpoint: ${dto.endpoint?.substring(0, 50)}...`);
|
||||
|
||||
const existing = await this.subscriptionRepo.findOne({
|
||||
where: { endpoint: dto.endpoint },
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
this.logger.log('Subscription already exists, updating...');
|
||||
if (dto.userId && existing.userId !== dto.userId) {
|
||||
existing.userId = dto.userId;
|
||||
return this.subscriptionRepo.save(existing);
|
||||
@@ -65,7 +61,6 @@ export class PushService implements OnModuleInit {
|
||||
return existing;
|
||||
}
|
||||
|
||||
this.logger.log('Creating new subscription...');
|
||||
const subscription = this.subscriptionRepo.create({
|
||||
endpoint: dto.endpoint,
|
||||
p256dh: dto.p256dh,
|
||||
@@ -73,9 +68,7 @@ export class PushService implements OnModuleInit {
|
||||
userId: dto.userId ?? null,
|
||||
});
|
||||
|
||||
const saved = await this.subscriptionRepo.save(subscription);
|
||||
this.logger.log(`Subscription saved with ID: ${saved.id}`);
|
||||
return saved;
|
||||
return this.subscriptionRepo.save(subscription);
|
||||
}
|
||||
|
||||
async unsubscribe(dto: UnsubscribeDto): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user