-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
11 changed files
with
155 additions
and
51 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
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
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
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,27 @@ | ||
import createServerSupabaseClient from '@/_utilities/create-server-supabase-client'; | ||
|
||
const getInputWithUses = (inputId: string) => | ||
createServerSupabaseClient() | ||
.from('inputs') | ||
.select( | ||
` | ||
id, | ||
label, | ||
options:input_options(id, label), | ||
settings, | ||
subjects(id), | ||
type, | ||
uses:event_types(subject:subjects(id, name, image_uri))`, | ||
) | ||
.eq('id', inputId) | ||
.eq('subjects.deleted', false) | ||
.not('subjects.archived', 'is', null) | ||
.eq('event_types.subjects.deleted', false) | ||
.order('order', { referencedTable: 'options' }) | ||
.single(); | ||
|
||
export type GetInputWithUsesData = Awaited< | ||
ReturnType<typeof getInputWithUses> | ||
>['data']; | ||
|
||
export default getInputWithUses; |
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
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,27 @@ | ||
import getCurrentUser from '@/_queries/get-current-user'; | ||
import createServerSupabaseClient from '@/_utilities/create-server-supabase-client'; | ||
|
||
const listInputsWithUses = async () => | ||
createServerSupabaseClient() | ||
.from('inputs') | ||
.select( | ||
` | ||
id, | ||
label, | ||
subjects(id, image_uri, name), | ||
type, | ||
uses:event_types(subject:subjects(id, name))`, | ||
) | ||
.eq('team_id', (await getCurrentUser())?.id ?? '') | ||
.eq('archived', false) | ||
.eq('subjects.deleted', false) | ||
.not('subjects.archived', 'is', null) | ||
.eq('event_types.subjects.deleted', false) | ||
.order('name', { referencedTable: 'subjects' }) | ||
.order('label'); | ||
|
||
export type ListInputsWithUsesData = Awaited< | ||
ReturnType<typeof listInputsWithUses> | ||
>['data']; | ||
|
||
export default listInputsWithUses; |
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