Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjcai committed Nov 2, 2023
1 parent f806541 commit b7e0116
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/api/supabase/queries/tests/user_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ export async function fullCartTest() {
await incrementCartItemByOne(testUserId, testItemId);
await incrementCartItemByOne(testUserId, testItemId);
await incrementCartItemByOne(testUserId, testItemId);
let result_1 = await fetchUserCart(testUserId);
console.log('fetchUserCart Result_1:', result_1);
let result1 = await fetchUserCart(testUserId);
console.log('fetchUserCart Result_1:', result1);
await decrementCartItemByOne(testUserId, testItemId);
result_1 = await fetchUserCart(testUserId);
console.log('fetchUserCart Result_2:', result_1);
result1 = await fetchUserCart(testUserId);
console.log('fetchUserCart Result_2:', result1);
await decrementCartItem(testUserId, testItemId, 6);

const result_3 = await fetchUserCart(testUserId);
console.log('fetchUserCart Result_3:', result_3);
const result3 = await fetchUserCart(testUserId);
console.log('fetchUserCart Result_3:', result3);
} catch (error) {
console.error('Error in incrementCartItemByOne:', error);
}
Expand Down
2 changes: 0 additions & 2 deletions src/api/supabase/queries/user_queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export async function updateCart(
userId: string,
currentCart: Record<string, number>,
) {

const { data, error } = await supabase
.from('profiles')
.update({ cart: currentCart })
Expand All @@ -79,7 +78,6 @@ export async function incrementCartItem(
itemId: string,
n: number,
) {

// First, fetch the current cart for the user
const { data, error }: { data: User | null; error: PostgrestError | null } =
await supabase.from('profiles').select('*').eq('user_id', userId).single();
Expand Down
1 change: 0 additions & 1 deletion src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ export type Product = {
photo: string; // text null;
updated_at: string; // timestamp with time zone not null default now();
};

0 comments on commit b7e0116

Please sign in to comment.