This repository was archived by the owner on May 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/integration nghia #2
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1e690b6
update: add dependencies
htnghia1423 ede925d
add: utils for date and price format
htnghia1423 08dc444
add: protect env variable
htnghia1423 ef98deb
add: create supabase client
htnghia1423 ce8f38c
add: services for handle action with image on supabase
htnghia1423 ac4fb14
add: store for redux
htnghia1423 61a8ebb
update: remove models
htnghia1423 94a24aa
add: types for object
htnghia1423 b03800a
add: services for object
htnghia1423 99ce956
add: slice for object
htnghia1423 5a6f228
add: component Loading
htnghia1423 b71d831
update: apply redux for all app
htnghia1423 de1b8a9
update: component gift card
htnghia1423 4534482
update: filter tab component
htnghia1423 c6a6f98
update: screens for app
htnghia1423 92801f6
update: add service function for update recipient
htnghia1423 8a2e905
update: update recipient spent when add gift
hardingadonis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add: services for object
- Loading branch information
commit b03800a4b8c1d9c091b83787a8e6c20a6eafc196
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { CreateGiftDTO, GiftIdea } from '@/features/gifts/types'; | ||
| import supabase from '@/services/supabaseClient'; | ||
|
|
||
| export const fetchGifts = async (): Promise<GiftIdea[]> => { | ||
| const { data, error } = await supabase.from('gifts').select('*'); | ||
| if (error) throw error; | ||
| return data as GiftIdea[]; | ||
| }; | ||
|
|
||
| export const addGift = async (gift: CreateGiftDTO): Promise<GiftIdea> => { | ||
| const { data, error } = await supabase.from('gifts').insert([gift]).single(); | ||
| if (error) throw error; | ||
| return data as GiftIdea; | ||
| }; | ||
|
|
||
| export const deleteGift = async (id: string): Promise<void> => { | ||
| const { error } = await supabase.from('gifts').delete().eq('id', id); | ||
| if (error) throw error; | ||
| }; | ||
|
|
||
| export const updateGift = async ( | ||
| gift: Partial<GiftIdea>, | ||
| ): Promise<GiftIdea> => { | ||
| const { data, error } = await supabase | ||
| .from('gifts') | ||
| .update(gift) | ||
| .eq('id', gift.id) | ||
| .select('*') | ||
| .single(); | ||
|
|
||
| if (error) { | ||
| console.error('Supabase updateGift error:', error); | ||
| throw error; | ||
| } | ||
|
|
||
| console.log('Supabase updateGift response:', data); | ||
| return data as GiftIdea; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||
| import { CreateRecipientDTO, Recipient } from '@/features/recipients/types'; | ||||||
| import supabase from '@/services/supabaseClient'; | ||||||
|
|
||||||
| export const fetchRecipients = async (): Promise<Recipient[]> => { | ||||||
| const { data, error } = await supabase.from('recipients').select('*'); | ||||||
| if (error) throw error; | ||||||
| return data as Recipient[]; | ||||||
| }; | ||||||
|
|
||||||
| export const addRecipient = async ( | ||||||
| recipient: CreateRecipientDTO, | ||||||
| ): Promise<Recipient> => { | ||||||
| const { data, error } = await supabase | ||||||
| .from('recipients') | ||||||
| .insert([recipient]) | ||||||
| .single(); | ||||||
| if (error) throw error; | ||||||
| return data as Recipient; | ||||||
| }; | ||||||
|
|
||||||
| export const deleteRecipient = async (id: string): Promise<void> => { | ||||||
| const { error } = await supabase.from('recipients').delete().eq('id', id); | ||||||
| if (error) throw error; | ||||||
| }; | ||||||
|
|
||||||
| export const findRecipientById = async (id: number): Promise<string | null> => { | ||||||
|
||||||
| export const findRecipientById = async (id: number): Promise<string | null> => { | |
| export const findRecipientById = async (id: string): Promise<string | null> => { |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider removing or replacing this console.log used for debugging with a proper logging mechanism before deploying to production.