From 4c0f5aa90d9b98d1b2d9996cb6617d3cfdb60de7 Mon Sep 17 00:00:00 2001 From: Kana Taguchi Date: Fri, 26 Jan 2024 13:28:51 -0800 Subject: [PATCH] Change tags form --- app/components/input/input-form.tsx | 2 +- app/components/input/input-icon.tsx | 1 + app/components/loading/loading.tsx | 10 +- app/trip/[id]/edit/page.tsx | 59 ++- app/trip/components/index.ts | 2 +- app/trip/components/tag-form-modal.tsx | 178 +++++++++ app/trip/components/trip-form-tag.tsx | 77 ---- app/trip/components/trip-form.tsx | 143 ++++++- app/trip/graphql/mutation/createTag.graphql | 9 + app/trip/graphql/mutation/deleteTag.graphql | 9 + app/trip/graphql/query/tagsCollection.graphql | 13 + app/trip/graphql/query/tripDetails.graphql | 2 + app/trip/schema.ts | 21 + graphql-codegen/generated/api.ts | 276 +++++++++++++ graphql-codegen/generated/gql.ts | 30 +- graphql-codegen/generated/graphql.ts | 374 +++++++++++++++++- .../generated/persisted-documents.json | 5 +- 17 files changed, 1103 insertions(+), 108 deletions(-) create mode 100644 app/trip/components/tag-form-modal.tsx delete mode 100644 app/trip/components/trip-form-tag.tsx create mode 100644 app/trip/graphql/mutation/createTag.graphql create mode 100644 app/trip/graphql/mutation/deleteTag.graphql create mode 100644 app/trip/graphql/query/tagsCollection.graphql create mode 100644 app/trip/schema.ts diff --git a/app/components/input/input-form.tsx b/app/components/input/input-form.tsx index 03a5c4d..50923cb 100644 --- a/app/components/input/input-form.tsx +++ b/app/components/input/input-form.tsx @@ -13,7 +13,7 @@ export const InputForm = forwardRef( const placeholdercolor = useColorModeValue('gray.400', 'gray.600') return ( - + ( type={onClick ? 'button' : 'submit'} onClick={onClick} color="primary.700" + isDisabled={props.isDisabled} > diff --git a/app/components/loading/loading.tsx b/app/components/loading/loading.tsx index fcb529f..5a724a1 100644 --- a/app/components/loading/loading.tsx +++ b/app/components/loading/loading.tsx @@ -1,14 +1,18 @@ import { VStack, Spinner } from '@chakra-ui/react' -export const Loading = () => { +type LoadingProps = { + size?: string + p?: string +} +export const Loading = ({ size = 'xl', p = '60px' }: LoadingProps) => { return ( - + ) diff --git a/app/trip/[id]/edit/page.tsx b/app/trip/[id]/edit/page.tsx index 7e491ea..ea0c9f6 100644 --- a/app/trip/[id]/edit/page.tsx +++ b/app/trip/[id]/edit/page.tsx @@ -1,15 +1,48 @@ 'use client' +import { NetworkStatus } from '@apollo/client' import { Box, Container, Heading, useColorModeValue } from '@chakra-ui/react' -// import { Loading } from '@/components/loading' +import { Loading } from '@/components/loading' import { Header, Footer } from '@/components/navigation' +import { useUserId } from '@/providers/session-provider' import { TripForm } from '../../components' +import { useTagsCollectionQuery, useTripDetailsQuery } from '@generated/api' export default function TripEditPage({ params }: { params: { id: string } }) { const bg = useColorModeValue('white', 'gray.800') const color = useColorModeValue('black', 'gray.300') - console.log(params) + const userId = useUserId() + + const { data: tripData, loading: tripLoading } = useTripDetailsQuery({ + variables: { + id: params.id + } + }) + + const { + data: tagsData, + loading: tagsLoading, + refetch: tagsRefetch, + networkStatus: tagsNetWorkStatus + } = useTagsCollectionQuery({ + variables: { userId }, + notifyOnNetworkStatusChange: true + }) + + if ((!tripData && !tripLoading) || (!tagsData && !tagsLoading)) + throw new Error('No trip data found') + + const tripDataCollection = tripData?.tripsCollection?.edges[0]?.node + + const tagsCollectionRefetch = () => { + tagsRefetch() + } + + const tagsRefetchLoading = tagsNetWorkStatus === NetworkStatus.refetch + + console.log('tripDataCollection', tripDataCollection) + console.log('tagsData', tagsData) return ( <> @@ -24,7 +57,27 @@ export default function TripEditPage({ params }: { params: { id: string } }) { Edit Trip - + {!tripDataCollection || tripLoading ? ( + + ) : ( + ({ + id: tag.node.id, + name: tag.node.name + })) || [] + } + cost={tripDataCollection.cost} + costUnit={tripDataCollection.cost_unit} + tagsCollectionRefetch={tagsCollectionRefetch} + tagsRefetchLoading={tagsRefetchLoading} + /> + )} diff --git a/app/trip/components/index.ts b/app/trip/components/index.ts index d1bbaa2..c641ef0 100644 --- a/app/trip/components/index.ts +++ b/app/trip/components/index.ts @@ -1,5 +1,5 @@ +export { TagFormModal } from './tag-form-modal' export { TripCard } from './trip-card' -export { TripFormTag } from './trip-form-tag' export { TripForm } from './trip-form' export { TripSearch } from './trip-search' export { TripSort } from './trip-sort' diff --git a/app/trip/components/tag-form-modal.tsx b/app/trip/components/tag-form-modal.tsx new file mode 100644 index 0000000..2e8a620 --- /dev/null +++ b/app/trip/components/tag-form-modal.tsx @@ -0,0 +1,178 @@ +import { KeyboardEvent } from 'react' +import { useForm } from 'react-hook-form' +import { + Modal, + ModalOverlay, + ModalContent, + ModalFooter, + ModalBody, + ModalCloseButton, + FormErrorMessage, + FormControl, + Flex, + Tag, + useColorModeValue, + Box, + Heading, + useToast +} from '@chakra-ui/react' +import { FiPlusCircle, FiX } from 'react-icons/fi' +import { InputIcon } from '@/components/input' +import { Loading } from '@/components/loading' +import { useUserId } from '@/providers/session-provider' +import { TagSchema, tagSchemaResolver } from '../schema' +import { useCreateTagMutation, useDeleteTagMutation } from '@generated/api' + +type TagFormModalProps = { + isOpen: boolean + onClose: () => void + tags: { id: string; name: string }[] + tagsCollectionRefetch: () => void +} + +export const TagFormModal = ({ + isOpen, + onClose, + tags, + tagsCollectionRefetch +}: TagFormModalProps) => { + const tagBgColor = useColorModeValue('primary.700', 'primary.800') + const userId = useUserId() + const toast = useToast() + + const { + register, + handleSubmit, + reset, + formState: { errors } + } = useForm({ + resolver: tagSchemaResolver + }) + + const [createTagMutation, { loading: isCreating }] = useCreateTagMutation() + const [deleteTagMutation, { loading: isDeleting }] = useDeleteTagMutation() + + const addTag = async (input: TagSchema) => { + try { + await createTagMutation({ + variables: { + name: input.name, + userId: userId + } + }) + reset() + tagsCollectionRefetch() + } catch (error) { + console.error(error) + toast({ + title: "We're sorry, but you failed to create a tag", + description: + error instanceof Error ? error.message : 'Please try again later.', + status: 'error', + duration: 5000, + isClosable: true, + position: 'top' + }) + } + } + + const addEnterHandler = (e: KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault() + handleSubmit(addTag)() + } + } + + const deleteTag = async (id: string) => { + try { + await deleteTagMutation({ + variables: { + id: id + } + }) + tagsCollectionRefetch() + } catch (error) { + console.error(error) + toast({ + title: "We're sorry, but you failed to delete a tag", + description: + error instanceof Error ? error.message : 'Please try again later.', + status: 'error', + duration: 5000, + isClosable: true, + position: 'top' + }) + } + } + + return ( + + + + + + + + + Tag List + + + {isCreating || isDeleting ? ( + + ) : ( + <> + {tags.map((tag) => ( + + {tag.name} + deleteTag(tag.id)} + > + + + + ))} + + )} + + + + + Add New Tag + + + + addEnterHandler(e)} + onClick={handleSubmit((d) => addTag(d))} + {...register('name')} + /> + {errors?.name?.message} + + + + + + + + + ) +} diff --git a/app/trip/components/trip-form-tag.tsx b/app/trip/components/trip-form-tag.tsx deleted file mode 100644 index 46c95ac..0000000 --- a/app/trip/components/trip-form-tag.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { useEffect, useRef, useState, KeyboardEvent } from 'react' -import { useFormContext } from 'react-hook-form' -import { - FormControl, - FormLabel, - Flex, - Tag, - useColorModeValue, - TagLabel, - TagCloseButton -} from '@chakra-ui/react' -import { FiPlusCircle } from 'react-icons/fi' -import { InputIcon } from '@/components/input' - -export const TripFormTag = () => { - const inputRef = useRef(null) - const [tags, setTags] = useState([]) - - const tagBgColor = useColorModeValue('primary.700', 'primary.800') - - const { setValue } = useFormContext() - - const addTag = () => { - const userInput = inputRef?.current?.value - if (userInput) { - setTags((prevTags) => [...prevTags, userInput]) - inputRef.current!.value = '' - } - } - - const addEnterHandler = (e: KeyboardEvent) => { - if (e.key === 'Enter') { - e.preventDefault() - addTag() - } - } - - const deleteClickHandler = (name: string) => { - setTags((prevTags) => prevTags.filter((tag) => tag !== name)) - } - - useEffect(() => { - setValue('tags', tags) - }, [tags, setValue]) - - return ( - - Tag - addEnterHandler(e)} - onClick={addTag} - /> - - {tags.map((tag, index) => ( - - {tag} - deleteClickHandler(tag)} /> - - ))} - - - ) -} diff --git a/app/trip/components/trip-form.tsx b/app/trip/components/trip-form.tsx index 21ca08a..d04ec0e 100644 --- a/app/trip/components/trip-form.tsx +++ b/app/trip/components/trip-form.tsx @@ -1,20 +1,66 @@ -import { useForm, FormProvider } from 'react-hook-form' +import { useForm } from 'react-hook-form' import { FormControl, FormLabel, - // FormErrorMessage, + FormErrorMessage, Image, VStack, HStack, - useColorModeValue + useColorModeValue, + CheckboxGroup, + Flex, + Checkbox, + Box, + useDisclosure } from '@chakra-ui/react' -import { PrimaryButton } from '@/components/button' +import { PrimaryButton, SecondaryButton } from '@/components/button' import { CustomDateTimePicker } from '@/components/customDateTimePicker' import { InputForm } from '@/components/input' -import { TripFormTag } from '../components' +import { Loading } from '@/components/loading' +import { TagFormModal } from '../components' +import { tripSchemaResolver, TripSchema } from '../schema' -export const TripForm = () => { - const methods = useForm() +type TripFormProps = { + id: string + image: string | null | undefined + title: string + dateFrom: string + dateTo: string | null | undefined + tags: { id: string; name: string }[] + cost: number | null | undefined + costUnit: string | null | undefined + tagsCollectionRefetch: () => void + tagsRefetchLoading: boolean +} + +export const TripForm = ({ + // id, + image, + title, + dateFrom, + dateTo, + tags, + cost, + costUnit, + tagsCollectionRefetch, + tagsRefetchLoading +}: TripFormProps) => { + const { isOpen, onOpen, onClose } = useDisclosure() + const { + register, + // handleSubmit, + formState: { errors } + } = useForm({ + defaultValues: { + title: title, + image_storage_object_id: image, + date_from: dateFrom, + date_to: dateTo, + cost: cost, + cost_unit: costUnit + }, + resolver: tripSchemaResolver + }) const imageSrc = useColorModeValue( '/images/no_image_light.jpg', @@ -22,46 +68,107 @@ export const TripForm = () => { ) return ( - + <> - + Title - + + {errors?.title?.message} - + Date From console.log('onChange')} value={null} /> + {errors?.date_from?.message} - + Date To console.log('onChange')} value={null} /> + {errors?.date_to?.message} - + Image Select Image + + {errors?.image_storage_object_id?.message} + - + + Tag + + + {tagsRefetchLoading ? ( + + ) : ( + <> + {tags.map((tag) => ( + + {tag.name} + + ))} + + )} + + + + + + Manage Tags + + - - Cost - + {/* {errors?.tags?.message} */} + + + Cost + + {errors?.cost?.message} + + + + Unit + + {errors?.cost_unit?.message} + + + Save Trip - + + + ) } diff --git a/app/trip/graphql/mutation/createTag.graphql b/app/trip/graphql/mutation/createTag.graphql new file mode 100644 index 0000000..1eb11e7 --- /dev/null +++ b/app/trip/graphql/mutation/createTag.graphql @@ -0,0 +1,9 @@ +mutation createTag($name: String!, $userId: UUID!) { + insertIntotagsCollection(objects: [{ name: $name, user_id: $userId }]) { + records { + __typename + id + name + } + } +} diff --git a/app/trip/graphql/mutation/deleteTag.graphql b/app/trip/graphql/mutation/deleteTag.graphql new file mode 100644 index 0000000..b312002 --- /dev/null +++ b/app/trip/graphql/mutation/deleteTag.graphql @@ -0,0 +1,9 @@ +mutation deleteTag($id: UUID!) { + deleteFromtagsCollection(filter: { id: { eq: $id } }) { + records { + __typename + id + name + } + } +} diff --git a/app/trip/graphql/query/tagsCollection.graphql b/app/trip/graphql/query/tagsCollection.graphql new file mode 100644 index 0000000..77af9bf --- /dev/null +++ b/app/trip/graphql/query/tagsCollection.graphql @@ -0,0 +1,13 @@ +query tagsCollection($userId: UUID!) { + tagsCollection( + filter: { user_id: { eq: $userId } } + orderBy: { created_at: AscNullsLast } + ) { + edges { + node { + id + name + } + } + } +} diff --git a/app/trip/graphql/query/tripDetails.graphql b/app/trip/graphql/query/tripDetails.graphql index 46480da..4918ae8 100644 --- a/app/trip/graphql/query/tripDetails.graphql +++ b/app/trip/graphql/query/tripDetails.graphql @@ -7,6 +7,8 @@ query tripDetails($id: UUID!) { date_from date_to image_storage_object_id + cost + cost_unit invitationsCollection { edges { node { diff --git a/app/trip/schema.ts b/app/trip/schema.ts new file mode 100644 index 0000000..f34006d --- /dev/null +++ b/app/trip/schema.ts @@ -0,0 +1,21 @@ +import { zodResolver } from '@hookform/resolvers/zod' +import * as z from 'zod' + +const tripSchema = z.object({ + title: z.string().min(1, { message: 'Title is required' }), + date_from: z.string().min(1, { message: 'Date from is required' }), + date_to: z.string().nullable(), + image_storage_object_id: z.string().nullable(), + cost: z.number().nullable(), + cost_unit: z.string().nullable() +}) + +export type TripSchema = z.infer +export const tripSchemaResolver = zodResolver(tripSchema) + +const tagSchema = z.object({ + name: z.string().min(1, { message: 'Tag name is required' }) +}) + +export type TagSchema = z.infer +export const tagSchemaResolver = zodResolver(tagSchema) diff --git a/graphql-codegen/generated/api.ts b/graphql-codegen/generated/api.ts index 35f4905..2670a63 100644 --- a/graphql-codegen/generated/api.ts +++ b/graphql-codegen/generated/api.ts @@ -468,6 +468,7 @@ export type Activity = Node & { __typename?: 'activity' address?: Maybe cost?: Maybe + cost_unit?: Maybe id: Scalars['UUID']['output'] image_storage_object_id?: Maybe memo?: Maybe @@ -504,6 +505,7 @@ export type ActivityEdge = { export type ActivityFilter = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -518,6 +520,7 @@ export type ActivityFilter = { export type ActivityInsertInput = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -539,6 +542,7 @@ export type ActivityInsertResponse = { export type ActivityOrderBy = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -552,6 +556,7 @@ export type ActivityOrderBy = { export type ActivityUpdateInput = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -677,11 +682,14 @@ export type Permission_Level_EnumFilter = { export type Tags = Node & { __typename?: 'tags' + created_at: Scalars['Datetime']['output'] id: Scalars['UUID']['output'] name: Scalars['String']['output'] /** Globally Unique Record Identifier */ nodeId: Scalars['ID']['output'] trip_tagsCollection?: Maybe + user_id: Scalars['UUID']['output'] + users: Users } export type TagsTrip_TagsCollectionArgs = { @@ -714,14 +722,18 @@ export type TagsEdge = { } export type TagsFilter = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe nodeId?: InputMaybe + user_id?: InputMaybe } export type TagsInsertInput = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe + user_id?: InputMaybe } export type TagsInsertResponse = { @@ -733,13 +745,17 @@ export type TagsInsertResponse = { } export type TagsOrderBy = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe + user_id?: InputMaybe } export type TagsUpdateInput = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe + user_id?: InputMaybe } export type TagsUpdateResponse = { @@ -889,6 +905,7 @@ export type Trips = Node & { __typename?: 'trips' activityCollection?: Maybe cost?: Maybe + cost_unit?: Maybe created_at: Scalars['Datetime']['output'] date_from: Scalars['Date']['output'] date_to?: Maybe @@ -953,6 +970,7 @@ export type TripsEdge = { export type TripsFilter = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -966,6 +984,7 @@ export type TripsFilter = { export type TripsInsertInput = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -986,6 +1005,7 @@ export type TripsInsertResponse = { export type TripsOrderBy = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -998,6 +1018,7 @@ export type TripsOrderBy = { export type TripsUpdateInput = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -1025,6 +1046,7 @@ export type Users = Node & { /** Globally Unique Record Identifier */ nodeId: Scalars['ID']['output'] profile_picture_url?: Maybe + tagsCollection?: Maybe tripsCollection?: Maybe } @@ -1037,6 +1059,15 @@ export type UsersInvitationsCollectionArgs = { orderBy?: InputMaybe> } +export type UsersTagsCollectionArgs = { + after?: InputMaybe + before?: InputMaybe + filter?: InputMaybe + first?: InputMaybe + last?: InputMaybe + orderBy?: InputMaybe> +} + export type UsersTripsCollectionArgs = { after?: InputMaybe before?: InputMaybe @@ -1159,6 +1190,19 @@ export type ActivityCollectionQuery = { } | null } +export type CreateTagMutationVariables = Exact<{ + name: Scalars['String']['input'] + userId: Scalars['UUID']['input'] +}> + +export type CreateTagMutation = { + __typename: 'Mutation' + insertIntotagsCollection?: { + __typename: 'tagsInsertResponse' + records: Array<{ __typename: 'tags'; id: string; name: string }> + } | null +} + export type CreateTripMutationVariables = Exact<{ user_id: Scalars['UUID']['input'] title: Scalars['String']['input'] @@ -1174,6 +1218,33 @@ export type CreateTripMutation = { } | null } +export type DeleteTagMutationVariables = Exact<{ + id: Scalars['UUID']['input'] +}> + +export type DeleteTagMutation = { + __typename: 'Mutation' + deleteFromtagsCollection: { + __typename: 'tagsDeleteResponse' + records: Array<{ __typename: 'tags'; id: string; name: string }> + } +} + +export type TagsCollectionQueryVariables = Exact<{ + userId: Scalars['UUID']['input'] +}> + +export type TagsCollectionQuery = { + __typename: 'Query' + tagsCollection?: { + __typename: 'tagsConnection' + edges: Array<{ + __typename: 'tagsEdge' + node: { __typename: 'tags'; id: string; name: string } + }> + } | null +} + export type TripDetailsQueryVariables = Exact<{ id: Scalars['UUID']['input'] }> @@ -1191,6 +1262,8 @@ export type TripDetailsQuery = { date_from: string date_to?: string | null image_storage_object_id?: string | null + cost?: number | null + cost_unit?: string | null invitationsCollection?: { __typename: 'invitationsConnection' edges: Array<{ @@ -1460,6 +1533,62 @@ export function refetchActivityCollectionQuery( ) { return { query: ActivityCollectionDocument, variables: variables } } +export const CreateTagDocument = gql` + mutation createTag($name: String!, $userId: UUID!) { + __typename + insertIntotagsCollection(objects: [{ name: $name, user_id: $userId }]) { + __typename + records { + __typename + id + name + } + } + } +` +export type CreateTagMutationFn = Apollo.MutationFunction< + CreateTagMutation, + CreateTagMutationVariables +> + +/** + * __useCreateTagMutation__ + * + * To run a mutation, you first call `useCreateTagMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useCreateTagMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [createTagMutation, { data, loading, error }] = useCreateTagMutation({ + * variables: { + * name: // value for 'name' + * userId: // value for 'userId' + * }, + * }); + */ +export function useCreateTagMutation( + baseOptions?: Apollo.MutationHookOptions< + CreateTagMutation, + CreateTagMutationVariables + > +) { + const options = { ...defaultOptions, ...baseOptions } + return Apollo.useMutation( + CreateTagDocument, + options + ) +} +export type CreateTagMutationHookResult = ReturnType< + typeof useCreateTagMutation +> +export type CreateTagMutationResult = Apollo.MutationResult +export type CreateTagMutationOptions = Apollo.BaseMutationOptions< + CreateTagMutation, + CreateTagMutationVariables +> export const CreateTripDocument = gql` mutation createTrip( $user_id: UUID! @@ -1532,6 +1661,151 @@ export type CreateTripMutationOptions = Apollo.BaseMutationOptions< CreateTripMutation, CreateTripMutationVariables > +export const DeleteTagDocument = gql` + mutation deleteTag($id: UUID!) { + __typename + deleteFromtagsCollection(filter: { id: { eq: $id } }) { + __typename + records { + __typename + id + name + } + } + } +` +export type DeleteTagMutationFn = Apollo.MutationFunction< + DeleteTagMutation, + DeleteTagMutationVariables +> + +/** + * __useDeleteTagMutation__ + * + * To run a mutation, you first call `useDeleteTagMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useDeleteTagMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [deleteTagMutation, { data, loading, error }] = useDeleteTagMutation({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useDeleteTagMutation( + baseOptions?: Apollo.MutationHookOptions< + DeleteTagMutation, + DeleteTagMutationVariables + > +) { + const options = { ...defaultOptions, ...baseOptions } + return Apollo.useMutation( + DeleteTagDocument, + options + ) +} +export type DeleteTagMutationHookResult = ReturnType< + typeof useDeleteTagMutation +> +export type DeleteTagMutationResult = Apollo.MutationResult +export type DeleteTagMutationOptions = Apollo.BaseMutationOptions< + DeleteTagMutation, + DeleteTagMutationVariables +> +export const TagsCollectionDocument = gql` + query tagsCollection($userId: UUID!) { + __typename + tagsCollection( + filter: { user_id: { eq: $userId } } + orderBy: { created_at: AscNullsLast } + ) { + __typename + edges { + __typename + node { + __typename + id + name + } + } + } + } +` + +/** + * __useTagsCollectionQuery__ + * + * To run a query within a React component, call `useTagsCollectionQuery` and pass it any options that fit your needs. + * When your component renders, `useTagsCollectionQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useTagsCollectionQuery({ + * variables: { + * userId: // value for 'userId' + * }, + * }); + */ +export function useTagsCollectionQuery( + baseOptions: Apollo.QueryHookOptions< + TagsCollectionQuery, + TagsCollectionQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions } + return Apollo.useQuery( + TagsCollectionDocument, + options + ) +} +export function useTagsCollectionLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + TagsCollectionQuery, + TagsCollectionQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions } + return Apollo.useLazyQuery( + TagsCollectionDocument, + options + ) +} +export function useTagsCollectionSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + TagsCollectionQuery, + TagsCollectionQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions } + return Apollo.useSuspenseQuery< + TagsCollectionQuery, + TagsCollectionQueryVariables + >(TagsCollectionDocument, options) +} +export type TagsCollectionQueryHookResult = ReturnType< + typeof useTagsCollectionQuery +> +export type TagsCollectionLazyQueryHookResult = ReturnType< + typeof useTagsCollectionLazyQuery +> +export type TagsCollectionSuspenseQueryHookResult = ReturnType< + typeof useTagsCollectionSuspenseQuery +> +export type TagsCollectionQueryResult = Apollo.QueryResult< + TagsCollectionQuery, + TagsCollectionQueryVariables +> +export function refetchTagsCollectionQuery( + variables: TagsCollectionQueryVariables +) { + return { query: TagsCollectionDocument, variables: variables } +} export const TripDetailsDocument = gql` query tripDetails($id: UUID!) { __typename @@ -1546,6 +1820,8 @@ export const TripDetailsDocument = gql` date_from date_to image_storage_object_id + cost + cost_unit invitationsCollection { __typename edges { diff --git a/graphql-codegen/generated/gql.ts b/graphql-codegen/generated/gql.ts index f4b387f..9d112f9 100644 --- a/graphql-codegen/generated/gql.ts +++ b/graphql-codegen/generated/gql.ts @@ -17,9 +17,15 @@ const documents = { types.GetUserDocument, 'query activityCollection($id: UUID!) {\n activityCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n trip_id\n title\n time_from\n time_to\n address\n url\n memo\n cost\n image_storage_object_id\n }\n }\n }\n}': types.ActivityCollectionDocument, + 'mutation createTag($name: String!, $userId: UUID!) {\n insertIntotagsCollection(objects: [{name: $name, user_id: $userId}]) {\n records {\n __typename\n id\n name\n }\n }\n}': + types.CreateTagDocument, 'mutation createTrip($user_id: UUID!, $title: String!, $date_from: Date, $date_to: Date) {\n insertIntotripsCollection(\n objects: [{user_id: $user_id, title: $title, date_from: $date_from, date_to: $date_to}]\n ) {\n records {\n __typename\n id\n title\n }\n }\n}': types.CreateTripDocument, - 'query tripDetails($id: UUID!) {\n tripsCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n title\n date_from\n date_to\n image_storage_object_id\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n title\n time_from\n time_to\n address\n }\n }\n }\n trip_tagsCollection {\n edges {\n node {\n tags {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n}': + 'mutation deleteTag($id: UUID!) {\n deleteFromtagsCollection(filter: {id: {eq: $id}}) {\n records {\n __typename\n id\n name\n }\n }\n}': + types.DeleteTagDocument, + 'query tagsCollection($userId: UUID!) {\n tagsCollection(\n filter: {user_id: {eq: $userId}}\n orderBy: {created_at: AscNullsLast}\n ) {\n edges {\n node {\n id\n name\n }\n }\n }\n}': + types.TagsCollectionDocument, + 'query tripDetails($id: UUID!) {\n tripsCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n title\n date_from\n date_to\n image_storage_object_id\n cost\n cost_unit\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n title\n time_from\n time_to\n address\n }\n }\n }\n trip_tagsCollection {\n edges {\n node {\n tags {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n}': types.TripDetailsDocument, 'query tripsCollection($filter: tripsFilter, $orderBy: [tripsOrderBy!], $first: Int!, $after: Cursor) {\n tripsCollection(\n filter: $filter\n first: $first\n after: $after\n orderBy: $orderBy\n ) {\n edges {\n node {\n id\n id\n title\n date_from\n date_to\n image_storage_object_id\n created_at\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n pageInfo {\n startCursor\n endCursor\n hasPreviousPage\n hasNextPage\n }\n }\n}': types.TripsCollectionDocument @@ -51,6 +57,12 @@ export function graphql( export function graphql( source: 'query activityCollection($id: UUID!) {\n activityCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n trip_id\n title\n time_from\n time_to\n address\n url\n memo\n cost\n image_storage_object_id\n }\n }\n }\n}' ): (typeof documents)['query activityCollection($id: UUID!) {\n activityCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n trip_id\n title\n time_from\n time_to\n address\n url\n memo\n cost\n image_storage_object_id\n }\n }\n }\n}'] +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: 'mutation createTag($name: String!, $userId: UUID!) {\n insertIntotagsCollection(objects: [{name: $name, user_id: $userId}]) {\n records {\n __typename\n id\n name\n }\n }\n}' +): (typeof documents)['mutation createTag($name: String!, $userId: UUID!) {\n insertIntotagsCollection(objects: [{name: $name, user_id: $userId}]) {\n records {\n __typename\n id\n name\n }\n }\n}'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -61,8 +73,20 @@ export function graphql( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: 'query tripDetails($id: UUID!) {\n tripsCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n title\n date_from\n date_to\n image_storage_object_id\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n title\n time_from\n time_to\n address\n }\n }\n }\n trip_tagsCollection {\n edges {\n node {\n tags {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n}' -): (typeof documents)['query tripDetails($id: UUID!) {\n tripsCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n title\n date_from\n date_to\n image_storage_object_id\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n title\n time_from\n time_to\n address\n }\n }\n }\n trip_tagsCollection {\n edges {\n node {\n tags {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n}'] + source: 'mutation deleteTag($id: UUID!) {\n deleteFromtagsCollection(filter: {id: {eq: $id}}) {\n records {\n __typename\n id\n name\n }\n }\n}' +): (typeof documents)['mutation deleteTag($id: UUID!) {\n deleteFromtagsCollection(filter: {id: {eq: $id}}) {\n records {\n __typename\n id\n name\n }\n }\n}'] +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: 'query tagsCollection($userId: UUID!) {\n tagsCollection(\n filter: {user_id: {eq: $userId}}\n orderBy: {created_at: AscNullsLast}\n ) {\n edges {\n node {\n id\n name\n }\n }\n }\n}' +): (typeof documents)['query tagsCollection($userId: UUID!) {\n tagsCollection(\n filter: {user_id: {eq: $userId}}\n orderBy: {created_at: AscNullsLast}\n ) {\n edges {\n node {\n id\n name\n }\n }\n }\n}'] +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: 'query tripDetails($id: UUID!) {\n tripsCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n title\n date_from\n date_to\n image_storage_object_id\n cost\n cost_unit\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n title\n time_from\n time_to\n address\n }\n }\n }\n trip_tagsCollection {\n edges {\n node {\n tags {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n}' +): (typeof documents)['query tripDetails($id: UUID!) {\n tripsCollection(filter: {id: {eq: $id}}) {\n edges {\n node {\n id\n title\n date_from\n date_to\n image_storage_object_id\n cost\n cost_unit\n invitationsCollection {\n edges {\n node {\n users {\n id\n profile_picture_url\n }\n }\n }\n }\n activityCollection {\n edges {\n node {\n id\n title\n time_from\n time_to\n address\n }\n }\n }\n trip_tagsCollection {\n edges {\n node {\n tags {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n}'] /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/graphql-codegen/generated/graphql.ts b/graphql-codegen/generated/graphql.ts index 1ad1470..34153c1 100644 --- a/graphql-codegen/generated/graphql.ts +++ b/graphql-codegen/generated/graphql.ts @@ -476,6 +476,7 @@ export type Activity = Node & { __typename?: 'activity' address?: Maybe cost?: Maybe + cost_unit?: Maybe id: Scalars['UUID']['output'] image_storage_object_id?: Maybe memo?: Maybe @@ -512,6 +513,7 @@ export type ActivityEdge = { export type ActivityFilter = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -526,6 +528,7 @@ export type ActivityFilter = { export type ActivityInsertInput = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -547,6 +550,7 @@ export type ActivityInsertResponse = { export type ActivityOrderBy = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -560,6 +564,7 @@ export type ActivityOrderBy = { export type ActivityUpdateInput = { address?: InputMaybe cost?: InputMaybe + cost_unit?: InputMaybe id?: InputMaybe image_storage_object_id?: InputMaybe memo?: InputMaybe @@ -685,11 +690,14 @@ export type Permission_Level_EnumFilter = { export type Tags = Node & { __typename?: 'tags' + created_at: Scalars['Datetime']['output'] id: Scalars['UUID']['output'] name: Scalars['String']['output'] /** Globally Unique Record Identifier */ nodeId: Scalars['ID']['output'] trip_tagsCollection?: Maybe + user_id: Scalars['UUID']['output'] + users: Users } export type TagsTrip_TagsCollectionArgs = { @@ -722,14 +730,18 @@ export type TagsEdge = { } export type TagsFilter = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe nodeId?: InputMaybe + user_id?: InputMaybe } export type TagsInsertInput = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe + user_id?: InputMaybe } export type TagsInsertResponse = { @@ -741,13 +753,17 @@ export type TagsInsertResponse = { } export type TagsOrderBy = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe + user_id?: InputMaybe } export type TagsUpdateInput = { + created_at?: InputMaybe id?: InputMaybe name?: InputMaybe + user_id?: InputMaybe } export type TagsUpdateResponse = { @@ -897,6 +913,7 @@ export type Trips = Node & { __typename?: 'trips' activityCollection?: Maybe cost?: Maybe + cost_unit?: Maybe created_at: Scalars['Datetime']['output'] date_from: Scalars['Date']['output'] date_to?: Maybe @@ -961,6 +978,7 @@ export type TripsEdge = { export type TripsFilter = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -974,6 +992,7 @@ export type TripsFilter = { export type TripsInsertInput = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -994,6 +1013,7 @@ export type TripsInsertResponse = { export type TripsOrderBy = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -1006,6 +1026,7 @@ export type TripsOrderBy = { export type TripsUpdateInput = { cost?: InputMaybe + cost_unit?: InputMaybe created_at?: InputMaybe date_from?: InputMaybe date_to?: InputMaybe @@ -1033,6 +1054,7 @@ export type Users = Node & { /** Globally Unique Record Identifier */ nodeId: Scalars['ID']['output'] profile_picture_url?: Maybe + tagsCollection?: Maybe tripsCollection?: Maybe } @@ -1045,6 +1067,15 @@ export type UsersInvitationsCollectionArgs = { orderBy?: InputMaybe> } +export type UsersTagsCollectionArgs = { + after?: InputMaybe + before?: InputMaybe + filter?: InputMaybe + first?: InputMaybe + last?: InputMaybe + orderBy?: InputMaybe> +} + export type UsersTripsCollectionArgs = { after?: InputMaybe before?: InputMaybe @@ -1167,6 +1198,19 @@ export type ActivityCollectionQuery = { } | null } +export type CreateTagMutationVariables = Exact<{ + name: Scalars['String']['input'] + userId: Scalars['UUID']['input'] +}> + +export type CreateTagMutation = { + __typename: 'Mutation' + insertIntotagsCollection?: { + __typename: 'tagsInsertResponse' + records: Array<{ __typename: 'tags'; id: string; name: string }> + } | null +} + export type CreateTripMutationVariables = Exact<{ user_id: Scalars['UUID']['input'] title: Scalars['String']['input'] @@ -1182,6 +1226,33 @@ export type CreateTripMutation = { } | null } +export type DeleteTagMutationVariables = Exact<{ + id: Scalars['UUID']['input'] +}> + +export type DeleteTagMutation = { + __typename: 'Mutation' + deleteFromtagsCollection: { + __typename: 'tagsDeleteResponse' + records: Array<{ __typename: 'tags'; id: string; name: string }> + } +} + +export type TagsCollectionQueryVariables = Exact<{ + userId: Scalars['UUID']['input'] +}> + +export type TagsCollectionQuery = { + __typename: 'Query' + tagsCollection?: { + __typename: 'tagsConnection' + edges: Array<{ + __typename: 'tagsEdge' + node: { __typename: 'tags'; id: string; name: string } + }> + } | null +} + export type TripDetailsQueryVariables = Exact<{ id: Scalars['UUID']['input'] }> @@ -1199,6 +1270,8 @@ export type TripDetailsQuery = { date_from: string date_to?: string | null image_storage_object_id?: string | null + cost?: number | null + cost_unit?: string | null invitationsCollection?: { __typename: 'invitationsConnection' edges: Array<{ @@ -1543,6 +1616,101 @@ export const ActivityCollectionDocument = { ActivityCollectionQuery, ActivityCollectionQueryVariables > +export const CreateTagDocument = { + __meta__: { hash: '9ecd6081f83febe06337ebd01345eef596b81cf9' }, + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'createTag' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { kind: 'Variable', name: { kind: 'Name', value: 'name' } }, + type: { + kind: 'NonNullType', + type: { kind: 'NamedType', name: { kind: 'Name', value: 'String' } } + } + }, + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'userId' } + }, + type: { + kind: 'NonNullType', + type: { kind: 'NamedType', name: { kind: 'Name', value: 'UUID' } } + } + } + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'insertIntotagsCollection' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'objects' }, + value: { + kind: 'ListValue', + values: [ + { + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'name' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'name' } + } + }, + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'user_id' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'userId' } + } + } + ] + } + ] + } + } + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'records' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: '__typename' } + }, + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'name' } } + ] + } + } + ] + } + } + ] + } + } + ] +} as unknown as DocumentNode export const CreateTripDocument = { __meta__: { hash: '995473133e320e5f7ef165df54d56100c62b3a75' }, kind: 'Document', @@ -1673,8 +1841,204 @@ export const CreateTripDocument = { } ] } as unknown as DocumentNode +export const DeleteTagDocument = { + __meta__: { hash: 'c661c9a00fdae1dbac69eeb283611e0c9202cf55' }, + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'mutation', + name: { kind: 'Name', value: 'deleteTag' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { kind: 'Variable', name: { kind: 'Name', value: 'id' } }, + type: { + kind: 'NonNullType', + type: { kind: 'NamedType', name: { kind: 'Name', value: 'UUID' } } + } + } + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'deleteFromtagsCollection' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'filter' }, + value: { + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'id' }, + value: { + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'eq' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'id' } + } + } + ] + } + } + ] + } + } + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'records' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: '__typename' } + }, + { kind: 'Field', name: { kind: 'Name', value: 'id' } }, + { kind: 'Field', name: { kind: 'Name', value: 'name' } } + ] + } + } + ] + } + } + ] + } + } + ] +} as unknown as DocumentNode +export const TagsCollectionDocument = { + __meta__: { hash: '994a2e7e0694c279cbfeff6c8696cbbe6a0c687c' }, + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + name: { kind: 'Name', value: 'tagsCollection' }, + variableDefinitions: [ + { + kind: 'VariableDefinition', + variable: { + kind: 'Variable', + name: { kind: 'Name', value: 'userId' } + }, + type: { + kind: 'NonNullType', + type: { kind: 'NamedType', name: { kind: 'Name', value: 'UUID' } } + } + } + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'tagsCollection' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'filter' }, + value: { + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'user_id' }, + value: { + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'eq' }, + value: { + kind: 'Variable', + name: { kind: 'Name', value: 'userId' } + } + } + ] + } + } + ] + } + }, + { + kind: 'Argument', + name: { kind: 'Name', value: 'orderBy' }, + value: { + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'created_at' }, + value: { kind: 'EnumValue', value: 'AscNullsLast' } + } + ] + } + } + ], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'edges' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: '__typename' } + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'node' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: '__typename' } + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'id' } + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'name' } + } + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] +} as unknown as DocumentNode export const TripDetailsDocument = { - __meta__: { hash: '911f735030ae63fca4ef8cefcc3c07e92924ea00' }, + __meta__: { hash: '12df849b2205e5cf49fd291f6cb8582aa49100c3' }, kind: 'Document', definitions: [ { @@ -1773,6 +2137,14 @@ export const TripDetailsDocument = { value: 'image_storage_object_id' } }, + { + kind: 'Field', + name: { kind: 'Name', value: 'cost' } + }, + { + kind: 'Field', + name: { kind: 'Name', value: 'cost_unit' } + }, { kind: 'Field', name: { diff --git a/graphql-codegen/generated/persisted-documents.json b/graphql-codegen/generated/persisted-documents.json index a3a76ec..5dfda2f 100644 --- a/graphql-codegen/generated/persisted-documents.json +++ b/graphql-codegen/generated/persisted-documents.json @@ -1,7 +1,10 @@ { "00c528b2b1c851c06119aedb1fba6b5c885713cf": "query getUser($id: UUID!) { __typename usersCollection(filter: {id: {eq: $id}}) { __typename edges { __typename node { __typename email id name profile_picture_url } } } }", "2d419044f6b09dcfdf15e868fceccda14add69f4": "query activityCollection($id: UUID!) { __typename activityCollection(filter: {id: {eq: $id}}) { __typename edges { __typename node { __typename address cost id image_storage_object_id memo time_from time_to title trip_id url } } } }", + "9ecd6081f83febe06337ebd01345eef596b81cf9": "mutation createTag($name: String!, $userId: UUID!) { __typename insertIntotagsCollection(objects: [{name: $name, user_id: $userId}]) { __typename records { __typename id name } } }", "995473133e320e5f7ef165df54d56100c62b3a75": "mutation createTrip($date_from: Date, $date_to: Date, $title: String!, $user_id: UUID!) { __typename insertIntotripsCollection( objects: [{user_id: $user_id, title: $title, date_from: $date_from, date_to: $date_to}] ) { __typename records { __typename id title } } }", - "911f735030ae63fca4ef8cefcc3c07e92924ea00": "query tripDetails($id: UUID!) { __typename tripsCollection(filter: {id: {eq: $id}}) { __typename edges { __typename node { __typename activityCollection { __typename edges { __typename node { __typename address id time_from time_to title } } } date_from date_to id image_storage_object_id invitationsCollection { __typename edges { __typename node { __typename users { __typename id profile_picture_url } } } } title trip_tagsCollection { __typename edges { __typename node { __typename tags { __typename id name } } } } } } } }", + "c661c9a00fdae1dbac69eeb283611e0c9202cf55": "mutation deleteTag($id: UUID!) { __typename deleteFromtagsCollection(filter: {id: {eq: $id}}) { __typename records { __typename id name } } }", + "994a2e7e0694c279cbfeff6c8696cbbe6a0c687c": "query tagsCollection($userId: UUID!) { __typename tagsCollection( filter: {user_id: {eq: $userId}} orderBy: {created_at: AscNullsLast} ) { __typename edges { __typename node { __typename id name } } } }", + "12df849b2205e5cf49fd291f6cb8582aa49100c3": "query tripDetails($id: UUID!) { __typename tripsCollection(filter: {id: {eq: $id}}) { __typename edges { __typename node { __typename activityCollection { __typename edges { __typename node { __typename address id time_from time_to title } } } cost cost_unit date_from date_to id image_storage_object_id invitationsCollection { __typename edges { __typename node { __typename users { __typename id profile_picture_url } } } } title trip_tagsCollection { __typename edges { __typename node { __typename tags { __typename id name } } } } } } } }", "70a61f873c23f1db13cef7cd265a9845e9bfc53e": "query tripsCollection($after: Cursor, $filter: tripsFilter, $first: Int!, $orderBy: [tripsOrderBy!]) { __typename tripsCollection( filter: $filter first: $first after: $after orderBy: $orderBy ) { __typename edges { __typename node { __typename activityCollection { __typename edges { __typename node { __typename id } } } created_at date_from date_to id id image_storage_object_id invitationsCollection { __typename edges { __typename node { __typename users { __typename id profile_picture_url } } } } title } } pageInfo { __typename endCursor hasNextPage hasPreviousPage startCursor } } }" }