diff options
| author | Fuwn <[email protected]> | 2024-07-25 00:24:50 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-07-25 00:24:50 -0700 |
| commit | 17ed84c223620c23064bdcf8dabc9edd02760be8 (patch) | |
| tree | 46677d07a7298f9bcb12fd0d82ca240eaea50b26 /src/lib/Database/Supabase/userNotifications.ts | |
| parent | refactor(Database): separate providers (diff) | |
| download | due.moe-17ed84c223620c23064bdcf8dabc9edd02760be8.tar.xz due.moe-17ed84c223620c23064bdcf8dabc9edd02760be8.zip | |
refactor(Database): move Supabase user modules to User module
Diffstat (limited to 'src/lib/Database/Supabase/userNotifications.ts')
| -rw-r--r-- | src/lib/Database/Supabase/userNotifications.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/lib/Database/Supabase/userNotifications.ts b/src/lib/Database/Supabase/userNotifications.ts deleted file mode 100644 index 48cd73c9..00000000 --- a/src/lib/Database/Supabase/userNotifications.ts +++ /dev/null @@ -1,32 +0,0 @@ -import supabase from '../supabase'; - -export interface UserNotifications { - created_at: string; - updated_at: string; - user_id: number; - subscription: JSON; -} - -export const getUserSubscription = async (userId: number) => - await supabase.from('user_notifications').select('*').eq('user_id', userId); - -export const getUserSubscriptions = async () => { - const { data, error } = await supabase.from('user_notifications').select('*'); - - if (error) return []; - - return data as UserNotifications[]; -}; - -export const deleteUserSubscription = async (userId: number) => - await supabase.from('user_notifications').delete().eq('user_id', userId); - -export const setUserSubscription = async (userId: number, subscription: JSON) => - await supabase.from('user_notifications').upsert( - { - user_id: userId, - updated_at: new Date().toISOString(), - subscription: subscription - }, - { onConflict: 'user_id' } - ); |