-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d08976
commit 58792e1
Showing
3 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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,19 @@ | ||
import { supabase } from 'services/supabase'; | ||
|
||
export async function getCliente(id: string) { | ||
const { data, error, status } = await supabase.rpc('busca_filtrada_usuarios', { | ||
p_id: id, | ||
p_name: '', | ||
p_ocupacao: 'cliente', | ||
p_fullname: '', | ||
p_email: '', | ||
p_picture: '', | ||
p_avatar_url: '', | ||
p_page: 0, | ||
p_limit: 10, | ||
p_orderby: 'name', | ||
p_ascordsc: 'asc', | ||
}); | ||
|
||
return { data, error, status }; | ||
} |
This file contains 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
This file contains 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,41 @@ | ||
import { format } from 'date-fns'; | ||
|
||
import { supabase } from 'services/supabase'; | ||
|
||
const atualDayFormatted = format(new Date(), 'yyyy-MM-dd'); | ||
const atualHourFormatted = format(new Date(), 'HH:mm'); | ||
|
||
export async function getHorarioMarcadoCliente(clientId: string, selectDayFormatted: string) { | ||
const { data, error, status } = await supabase.rpc('busca_filtrada_schedules', { | ||
p_id: [], | ||
p_barber_id: [], | ||
p_client_id: [clientId], | ||
p_dt_inicio: | ||
atualDayFormatted === selectDayFormatted | ||
? `${selectDayFormatted}T${atualHourFormatted}` | ||
: `${selectDayFormatted}T00:00`, | ||
p_dt_fim: `${selectDayFormatted}T23:59`, | ||
p_page: 0, | ||
p_limit: 10, | ||
p_orderby: 'hour', | ||
p_ascordsc: 'asc', | ||
}); | ||
|
||
return { data, error, status }; | ||
} | ||
|
||
export async function getHorarioSelecionado(clientId: string, selectDayFormatted: string, hour: string) { | ||
const { data, error, status } = await supabase.rpc('busca_filtrada_schedules', { | ||
p_id: [], | ||
p_barber_id: [], | ||
p_client_id: [clientId], | ||
p_dt_inicio: `${selectDayFormatted}T${hour}`, | ||
p_dt_fim: `${selectDayFormatted}T${hour}`, | ||
p_page: 0, | ||
p_limit: 10, | ||
p_orderby: 'hour', | ||
p_ascordsc: 'asc', | ||
}); | ||
|
||
return { data, error, status }; | ||
} |