From ac808fcabe4f480e3602c96ffe434c74d4e63c78 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 27 Nov 2022 12:11:04 -0500 Subject: [PATCH] Added timestamp to notifications --- Public API v1.yaml | 3 +++ backend/notifications.js | 3 ++- src/api-types/models/Notification.ts | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 5b711a1..9b46e55 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -2761,6 +2761,7 @@ components: - type - text - read + - timestamp type: object properties: type: @@ -2777,6 +2778,8 @@ components: type: boolean data: type: object + timestamp: + type: number NotificationAction: type: string enum: diff --git a/backend/notifications.js b/backend/notifications.js index 954c5d4..daa0a83 100644 --- a/backend/notifications.js +++ b/backend/notifications.js @@ -26,7 +26,8 @@ exports.createNotification = (type, actions, data, user_uid) => { data: data, user_uid: user_uid, uid: uuid(), - read: false + read: false, + timestamp: Date.now()/1000 } return notification; } diff --git a/src/api-types/models/Notification.ts b/src/api-types/models/Notification.ts index 704533c..ce99fe6 100644 --- a/src/api-types/models/Notification.ts +++ b/src/api-types/models/Notification.ts @@ -12,4 +12,5 @@ export type Notification = { action?: Array; read: boolean; data?: any; + timestamp: number; }; \ No newline at end of file