34 lines
664 B
TypeScript
34 lines
664 B
TypeScript
import { IsBoolean, IsIn, IsOptional, IsString, IsUrl, ValidateNested } from "class-validator";
|
|
import { Type } from "class-transformer";
|
|
|
|
export class UpdateNotificationPreferencesDto {
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
emailEnabled?: boolean;
|
|
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
pushEnabled?: boolean;
|
|
|
|
@IsOptional()
|
|
@IsIn(["info", "warning", "critical"])
|
|
minSeverity?: "info" | "warning" | "critical";
|
|
}
|
|
|
|
class PushKeysDto {
|
|
@IsString()
|
|
p256dh!: string;
|
|
|
|
@IsString()
|
|
auth!: string;
|
|
}
|
|
|
|
export class SavePushSubscriptionDto {
|
|
@IsUrl({ require_tld: false })
|
|
endpoint!: string;
|
|
|
|
@ValidateNested()
|
|
@Type(() => PushKeysDto)
|
|
keys!: PushKeysDto;
|
|
}
|