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.
This commit is contained in:
parent
70701aa124
commit
8ef764e664
@ -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";
|
import { Type } from "class-transformer";
|
||||||
|
|
||||||
export class UpdateNotificationPreferencesDto {
|
export class UpdateNotificationPreferencesDto {
|
||||||
@ -30,4 +30,11 @@ export class SavePushSubscriptionDto {
|
|||||||
@ValidateNested()
|
@ValidateNested()
|
||||||
@Type(() => PushKeysDto)
|
@Type(() => PushKeysDto)
|
||||||
keys!: 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;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user