aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Data
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-02-14 01:57:30 -0800
committerFuwn <[email protected]>2025-02-14 01:57:30 -0800
commitcbd31e2734352f73c2d57abf9b631ffbc4053c40 (patch)
treeef5c2105d2685ee7eab4f8b0c91f139a03c876ed /src/lib/Data
parentfeat(Tools): Use generic birthdays tool template, adds NIJISANJI birthdays tool (diff)
downloaddue.moe-cbd31e2734352f73c2d57abf9b631ffbc4053c40.tar.xz
due.moe-cbd31e2734352f73c2d57abf9b631ffbc4053c40.zip
style: Run formatter
Diffstat (limited to 'src/lib/Data')
-rw-r--r--src/lib/Data/AniList/notifications.ts40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/lib/Data/AniList/notifications.ts b/src/lib/Data/AniList/notifications.ts
index 3b0a9648..184ffe95 100644
--- a/src/lib/Data/AniList/notifications.ts
+++ b/src/lib/Data/AniList/notifications.ts
@@ -1,4 +1,4 @@
-import { database } from "$lib/Database/IDB/user";
+import { database } from '$lib/Database/IDB/user';
export interface Notification {
user: {
@@ -18,18 +18,18 @@ export interface Notification {
id: number;
createdAt: number;
type:
- | 'FOLLOWING'
- | 'ACTIVITY_MESSAGE'
- | 'ACTIVITY_MENTION'
- | 'ACTIVITY_REPLY'
- | 'ACTIVITY_REPLY_SUBSCRIBED'
- | 'ACTIVITY_LIKE'
- | 'ACTIVITY_REPLY_LIKE'
- | 'THREAD_COMMENT_MENTION'
- | 'THREAD_COMMENT_REPLY'
- | 'THREAD_SUBSCRIBED'
- | 'THREAD_COMMENT_LIKE'
- | 'THREAD_LIKE';
+ | 'FOLLOWING'
+ | 'ACTIVITY_MESSAGE'
+ | 'ACTIVITY_MENTION'
+ | 'ACTIVITY_REPLY'
+ | 'ACTIVITY_REPLY_SUBSCRIBED'
+ | 'ACTIVITY_LIKE'
+ | 'ACTIVITY_REPLY_LIKE'
+ | 'THREAD_COMMENT_MENTION'
+ | 'THREAD_COMMENT_REPLY'
+ | 'THREAD_SUBSCRIBED'
+ | 'THREAD_COMMENT_LIKE'
+ | 'THREAD_LIKE';
}
export const notifications = async (accessToken: string): Promise<Notification[] | null> => {
@@ -79,12 +79,16 @@ export const notifications = async (accessToken: string): Promise<Notification[]
return data['data']['Page']['notifications'];
};
-export const isNotificationQueued = (recentNotifications: Notification[] | null, lastNotificationID: number | null) =>
+export const isNotificationQueued = (
+ recentNotifications: Notification[] | null,
+ lastNotificationID: number | null
+) =>
recentNotifications &&
recentNotifications.length > 0 &&
(recentNotifications[0].id > (lastNotificationID as number) ||
- new Date(recentNotifications[0].createdAt * 1000).getTime() + 30000 >
- new Date().getTime())
+ new Date(recentNotifications[0].createdAt * 1000).getTime() + 30000 > new Date().getTime());
-export const updateLastNotificationID = async (userID: number, recentNotifications: Notification[]) =>
- await database.users.update(userID, { lastNotificationID: recentNotifications[0].id });
+export const updateLastNotificationID = async (
+ userID: number,
+ recentNotifications: Notification[]
+) => await database.users.update(userID, { lastNotificationID: recentNotifications[0].id });