From 2ebf1e7634e4a95037b75c4451965b12145799bb Mon Sep 17 00:00:00 2001 From: Philip Ye <97428041+philipye314@users.noreply.github.com> Date: Sat, 21 Oct 2023 11:44:28 -0700 Subject: [PATCH] fixed the query doubled file --- .../Cases/QRCodeScanner/AddCase/index.tsx | 3 +-- src/supabase/queries/case.ts | 20 ------------------- src/supabase/queries/cases.ts | 11 ++++++++++ 3 files changed, 12 insertions(+), 22 deletions(-) delete mode 100644 src/supabase/queries/case.ts diff --git a/src/app/(BottomTabNavigation)/Cases/QRCodeScanner/AddCase/index.tsx b/src/app/(BottomTabNavigation)/Cases/QRCodeScanner/AddCase/index.tsx index 35c7e333..d7c9324f 100644 --- a/src/app/(BottomTabNavigation)/Cases/QRCodeScanner/AddCase/index.tsx +++ b/src/app/(BottomTabNavigation)/Cases/QRCodeScanner/AddCase/index.tsx @@ -1,7 +1,6 @@ import { useLocalSearchParams, useRouter } from 'expo-router'; -import React, { useEffect, useState } from 'react'; import { Image, Text, TouchableOpacity, View } from 'react-native'; -import { getCase, uploadCase } from '../../../../../supabase/queries/case'; +import { uploadCase } from '../../../../../supabase/queries/cases'; import { CaseUid } from '../../../../../types/types'; import styles from './styles'; diff --git a/src/supabase/queries/case.ts b/src/supabase/queries/case.ts deleted file mode 100644 index 45b8090e..00000000 --- a/src/supabase/queries/case.ts +++ /dev/null @@ -1,20 +0,0 @@ -import supabase from '../createClient'; - -export const getCase = async (caseId: any) => { - const { data, error } = await supabase - .from('Cases') - .select() - .eq('id', caseId); - return { data, error }; -}; - -export const uploadCase = async (caseId: any) => { - const { - data: { user }, - } = await supabase.auth.getUser(); - const userId = user?.id; - const { error } = await supabase.from('status').insert({ caseId, userId }); - - console.log(error); - return { error }; -}; diff --git a/src/supabase/queries/cases.ts b/src/supabase/queries/cases.ts index 72e2b937..002bbafb 100644 --- a/src/supabase/queries/cases.ts +++ b/src/supabase/queries/cases.ts @@ -71,6 +71,17 @@ export async function getCasesByIds(caseIds: CaseUid[]): Promise { } } +export const uploadCase = async (caseId: any) => { + const { + data: { user }, + } = await supabase.auth.getUser(); + const userId = user?.id; + const { error } = await supabase.from('status').insert({ caseId, userId }); + + console.log(error); + return { error }; +}; + /** * Parse supabase case query and return Case object. *