From 8ef764e6641f9a354b2b8a7411991b1dee3bcb47 Mon Sep 17 00:00:00 2001 From: MOHAN Date: Wed, 26 Aug 2026 23:58:46 +0530 Subject: [PATCH] Accept expirationTime on push subscription save PushSubscription.toJSON() includes an expirationTime field (often null, sometimes a number for renewable subscriptions), but SavePushSubscriptionDto didn't declare it, so saving a push subscription 400'd under the whitelist validation pipe whenever the browser included it. --- src/notifications/notifications.dto.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/notifications/notifications.dto.ts b/src/notifications/notifications.dto.ts index 995d586..1044321 100644 --- a/src/notifications/notifications.dto.ts +++ b/src/notifications/notifications.dto.ts @@ -1,4 +1,4 @@ -import { IsBoolean, IsIn, IsOptional, IsString, IsUrl, ValidateNested } from "class-validator"; +import { IsBoolean, IsIn, IsNumber, IsOptional, IsString, IsUrl, ValidateNested } from "class-validator"; import { Type } from "class-transformer"; export class UpdateNotificationPreferencesDto { @@ -30,4 +30,11 @@ export class SavePushSubscriptionDto { @ValidateNested() @Type(() => PushKeysDto) keys!: PushKeysDto; + + // Included by the browser's PushSubscription.toJSON() when the push + // service provides an expiry; not currently used server-side, but must be + // declared or the whitelist validation pipe rejects the whole request. + @IsOptional() + @IsNumber() + expirationTime?: number | null; }