mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
* [PM-10611] Remove Angular dependencies from Notifications module * [PM-10611] Move end user notification service to /libs/common/vault/notifications * [PM-10611] Implement listenForEndUserNotifications() for EndUserNotificationService * [PM-10611] Add missing taskId to notification models * [PM-10611] Add switch cases for end user notification payloads * [PM-10611] Mark task related notifications as read when visiting the at-risk password page * [PM-10611] Revert change to default-notifications service * [PM-10611] Fix test * [PM-10611] Fix tests and log warning in case more notifications than the default page size are available * [PM-10611] Use separate feature flag for end user notifications * [PM-10611] Fix test
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { Jsonify } from "type-fest";
|
|
|
|
import { NotificationId, SecurityTaskId } from "@bitwarden/common/types/guid";
|
|
|
|
import { NotificationViewResponse } from "./notification-view.response";
|
|
|
|
export class NotificationViewData {
|
|
id: NotificationId;
|
|
priority: number;
|
|
title: string;
|
|
body: string;
|
|
date: Date;
|
|
taskId?: SecurityTaskId;
|
|
readDate: Date | null;
|
|
deletedDate: Date | null;
|
|
|
|
constructor(response: NotificationViewResponse) {
|
|
this.id = response.id;
|
|
this.priority = response.priority;
|
|
this.title = response.title;
|
|
this.body = response.body;
|
|
this.date = response.date;
|
|
this.taskId = response.taskId;
|
|
this.readDate = response.readDate;
|
|
this.deletedDate = response.deletedDate;
|
|
}
|
|
|
|
static fromJSON(obj: Jsonify<NotificationViewData>) {
|
|
return Object.assign(new NotificationViewData({} as NotificationViewResponse), obj, {
|
|
id: obj.id,
|
|
priority: obj.priority,
|
|
title: obj.title,
|
|
body: obj.body,
|
|
date: new Date(obj.date),
|
|
taskId: obj.taskId,
|
|
readDate: obj.readDate ? new Date(obj.readDate) : null,
|
|
deletedDate: obj.deletedDate ? new Date(obj.deletedDate) : null,
|
|
});
|
|
}
|
|
}
|