diff --git a/app/api/gql/graphql.ts b/app/api/gql/graphql.ts index e9fbae5..70162ab 100644 --- a/app/api/gql/graphql.ts +++ b/app/api/gql/graphql.ts @@ -100,13 +100,13 @@ export type CreateCommunityInput = { }; export type CreateCompanyInput = { - description: InputMaybe; + description?: InputMaybe; /** The email domain of the company (What we'll use to match the company to the user on account-creation) */ domain: Scalars["String"]["input"]; - logo: InputMaybe; - name: InputMaybe; - status: InputMaybe; - website: InputMaybe; + logo?: InputMaybe; + name?: InputMaybe; + status?: InputMaybe; + website?: InputMaybe; }; export type CreateSalaryInput = { @@ -161,39 +161,39 @@ export type Event = { /** Representation of an Event (Events and Users, is what tickets are linked to) */ export type EventUsersTicketsArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type EventCreateInput = { - address: InputMaybe; + address?: InputMaybe; communityId: Scalars["String"]["input"]; description: Scalars["String"]["input"]; - endDateTime: InputMaybe; - latitude: InputMaybe; - longitude: InputMaybe; + endDateTime?: InputMaybe; + latitude?: InputMaybe; + longitude?: InputMaybe; maxAttendees: Scalars["Int"]["input"]; - meetingURL: InputMaybe; + meetingURL?: InputMaybe; name: Scalars["String"]["input"]; startDateTime: Scalars["DateTime"]["input"]; - status: InputMaybe; - timeZone: InputMaybe; - visibility: InputMaybe; + status?: InputMaybe; + timeZone?: InputMaybe; + visibility?: InputMaybe; }; export type EventEditInput = { - address: InputMaybe; - description: InputMaybe; - endDateTime: InputMaybe; + address?: InputMaybe; + description?: InputMaybe; + endDateTime?: InputMaybe; eventId: Scalars["String"]["input"]; - latitude: InputMaybe; - longitude: InputMaybe; - maxAttendees: InputMaybe; - meetingURL: InputMaybe; - name: InputMaybe; - startDateTime: InputMaybe; - status: InputMaybe; - timeZone: InputMaybe; - visibility: InputMaybe; + latitude?: InputMaybe; + longitude?: InputMaybe; + maxAttendees?: InputMaybe; + meetingURL?: InputMaybe; + name?: InputMaybe; + startDateTime?: InputMaybe; + status?: InputMaybe; + timeZone?: InputMaybe; + visibility?: InputMaybe; }; /** Search for tags */ @@ -213,19 +213,19 @@ export enum EventVisibility { } export type EventsSearchInput = { - id: InputMaybe; - name: InputMaybe; - startDateTimeFrom: InputMaybe; - startDateTimeTo: InputMaybe; - status: InputMaybe; - visibility: InputMaybe; + id?: InputMaybe; + name?: InputMaybe; + startDateTimeFrom?: InputMaybe; + startDateTimeTo?: InputMaybe; + status?: InputMaybe; + visibility?: InputMaybe; }; export type EventsTicketsSearchInput = { - approvalStatus: InputMaybe; - id: InputMaybe; - paymentStatus: InputMaybe; - redemptionStatus: InputMaybe; + approvalStatus?: InputMaybe; + id?: InputMaybe; + paymentStatus?: InputMaybe; + redemptionStatus?: InputMaybe; }; export enum Gender { @@ -376,15 +376,15 @@ export type MutationValidateWorkEmailArgs = { }; export type MyTicketsSearchValues = { - approvalStatus: InputMaybe; - eventId: InputMaybe; - paymentStatus: InputMaybe; - redemptionStatus: InputMaybe; + approvalStatus?: InputMaybe; + eventId?: InputMaybe; + paymentStatus?: InputMaybe; + redemptionStatus?: InputMaybe; }; export type PaginatedInputMyTicketsSearchValues = { - pagination: PaginationSearchInputParams; - search: InputMaybe; + pagination?: PaginationSearchInputParams; + search?: InputMaybe; }; /** Type used for querying the paginated leaves and it's paginated meta data */ @@ -499,9 +499,9 @@ export type Query = { }; export type QueryCommunitiesArgs = { - id: InputMaybe; - name: InputMaybe; - status: InputMaybe; + id?: InputMaybe; + name?: InputMaybe; + status?: InputMaybe; }; export type QueryCommunityArgs = { @@ -509,7 +509,7 @@ export type QueryCommunityArgs = { }; export type QueryCompaniesArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type QueryCompanyArgs = { @@ -525,7 +525,7 @@ export type QueryEventImagesArgs = { }; export type QueryEventsArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type QueryMyTicketsArgs = { @@ -541,11 +541,11 @@ export type QuerySearchPaymentLogsArgs = { }; export type QueryStatusArgs = { - name: InputMaybe; + name?: InputMaybe; }; export type QueryTagsArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type QueryUserSearchArgs = { @@ -594,14 +594,14 @@ export type SanityAssetRef = { }; export type SearchCompaniesInput = { - companyName: InputMaybe; - description: InputMaybe; - domain: InputMaybe; - website: InputMaybe; + companyName?: InputMaybe; + description?: InputMaybe; + domain?: InputMaybe; + website?: InputMaybe; }; export type SearchPaymentLogsInput = { - endDate: InputMaybe; + endDate?: InputMaybe; startDate: Scalars["DateTime"]["input"]; }; @@ -624,9 +624,9 @@ export type Tag = { }; export type TagSearchInput = { - description: InputMaybe; - id: InputMaybe; - name: InputMaybe; + description?: InputMaybe; + id?: InputMaybe; + name?: InputMaybe; }; /** Representation of a ticket */ @@ -659,43 +659,43 @@ export enum TicketApprovalStatus { export type TicketClaimInput = { /** If this field is passed, a purchase order payment link will be generated right away */ - generatePaymentLink: InputMaybe; + generatePaymentLink?: InputMaybe; /** A unique key to prevent duplicate requests, it's optional to send, but it's recommended to send it to prevent duplicate requests. If not sent, it will be created by the server. */ - idempotencyUUIDKey: InputMaybe; + idempotencyUUIDKey?: InputMaybe; purchaseOrder: Array; }; export type TicketCreateInput = { - description: InputMaybe; - endDateTime: InputMaybe; + description?: InputMaybe; + endDateTime?: InputMaybe; eventId: Scalars["String"]["input"]; /** If the ticket is free, the price submitted will be ignored. */ isFree: Scalars["Boolean"]["input"]; name: Scalars["String"]["input"]; - prices: InputMaybe>; - quantity: InputMaybe; - requiresApproval: InputMaybe; + prices?: InputMaybe>; + quantity?: InputMaybe; + requiresApproval?: InputMaybe; startDateTime: Scalars["DateTime"]["input"]; - status: InputMaybe; + status?: InputMaybe; /** If provided, quantity must not be passed. This is for things like online events where there is no limit to the amount of tickets that can be sold. */ unlimitedTickets: Scalars["Boolean"]["input"]; - visibility: InputMaybe; + visibility?: InputMaybe; }; export type TicketEditInput = { - description: InputMaybe; - endDateTime: InputMaybe; - eventId: InputMaybe; - name: InputMaybe; - prices: InputMaybe; - quantity: InputMaybe; - requiresApproval: InputMaybe; - startDateTime: InputMaybe; - status: InputMaybe; + description?: InputMaybe; + endDateTime?: InputMaybe; + eventId?: InputMaybe; + name?: InputMaybe; + prices?: InputMaybe; + quantity?: InputMaybe; + requiresApproval?: InputMaybe; + startDateTime?: InputMaybe; + status?: InputMaybe; ticketId: Scalars["String"]["input"]; /** If provided, quantity must not be passed. This is for things like online events where there is no limit to the amount of tickets that can be sold. */ - unlimitedTickets: InputMaybe; - visibility: InputMaybe; + unlimitedTickets?: InputMaybe; + visibility?: InputMaybe; }; export enum TicketPaymentStatus { @@ -728,33 +728,33 @@ export enum TypeOfEmployment { export type UpdateCommunityInput = { communityId: Scalars["String"]["input"]; - description: InputMaybe; - name: InputMaybe; - slug: InputMaybe; - status: InputMaybe; + description?: InputMaybe; + name?: InputMaybe; + slug?: InputMaybe; + status?: InputMaybe; }; export type UpdateCompanyInput = { companyId: Scalars["String"]["input"]; - description: InputMaybe; - domain: InputMaybe; - logo: InputMaybe; - name: InputMaybe; - website: InputMaybe; + description?: InputMaybe; + domain?: InputMaybe; + logo?: InputMaybe; + name?: InputMaybe; + website?: InputMaybe; }; export type UpdateSalaryInput = { - amount: InputMaybe; + amount?: InputMaybe; confirmationToken: Scalars["String"]["input"]; - countryCode: InputMaybe; - currencyCode: InputMaybe; - gender: InputMaybe; - genderOtherText: InputMaybe; + countryCode?: InputMaybe; + currencyCode?: InputMaybe; + gender?: InputMaybe; + genderOtherText?: InputMaybe; salaryId: Scalars["String"]["input"]; - typeOfEmployment: InputMaybe; - workMetodology: InputMaybe; - workSeniorityAndRoleId: InputMaybe; - yearsOfExperience: InputMaybe; + typeOfEmployment?: InputMaybe; + workMetodology?: InputMaybe; + workSeniorityAndRoleId?: InputMaybe; + yearsOfExperience?: InputMaybe; }; /** Representation of a user */ @@ -773,6 +773,7 @@ export type UserTicket = { approvalStatus: TicketApprovalStatus; id: Scalars["ID"]["output"]; paymentStatus: TicketPaymentStatus; + purchaseOrder: Maybe; redemptionStatus: TicketRedemptionStatus; ticketTemplate: Ticket; }; @@ -830,15 +831,15 @@ export type UpdateUserRoleInCommunityInput = { }; export type UserEditInput = { - bio: InputMaybe; + bio?: InputMaybe; id: Scalars["String"]["input"]; - lastName: InputMaybe; - name: InputMaybe; - username: InputMaybe; + lastName?: InputMaybe; + name?: InputMaybe; + username?: InputMaybe; }; export type UserSearchInput = { - tags: InputMaybe>; + tags?: InputMaybe>; }; export type FetchExampleEventsQueryVariables = Exact<{ [key: string]: never }>; diff --git a/app/api/gql/schema.gql b/app/api/gql/schema.gql index 256d8d8..12b5b5b 100644 --- a/app/api/gql/schema.gql +++ b/app/api/gql/schema.gql @@ -787,6 +787,7 @@ type UserTicket { approvalStatus: TicketApprovalStatus! id: ID! paymentStatus: TicketPaymentStatus! + purchaseOrder: PurchaseOrder redemptionStatus: TicketRedemptionStatus! ticketTemplate: Ticket! } diff --git a/app/components/MyTickets/MyTickets.tsx b/app/components/MyTickets/MyTickets.tsx new file mode 100644 index 0000000..233f7a6 --- /dev/null +++ b/app/components/MyTickets/MyTickets.tsx @@ -0,0 +1,11 @@ +import { Suspense } from "react"; + +import { MyTicketsList } from "~/components/MyTickets/MyTicketsList"; + +export const MyTickets = () => { + return ( + + + + ); +}; diff --git a/app/components/MyTickets/MyTicketsList.tsx b/app/components/MyTickets/MyTicketsList.tsx new file mode 100644 index 0000000..568b62c --- /dev/null +++ b/app/components/MyTickets/MyTicketsList.tsx @@ -0,0 +1,28 @@ +import { TicketApprovalStatus } from "~/api/gql/graphql"; +import { useMyTicketsSuspenseQuery } from "~/components/MyTickets/graphql/myTickets.generated"; + +export const MyTicketsList = () => { + const tickets = useMyTicketsSuspenseQuery({ + variables: { + input: { + pagination: { + page: 0, + pageSize: 10, + }, + search: { + approvalStatus: TicketApprovalStatus.Approved, + }, + }, + }, + }); + + const myTickets = tickets.data.myTickets?.data?.map((ticket) => ticket); + + return ( +
+ {myTickets.map((ticket) => ( +
{ticket.id}
+ ))} +
+ ); +}; diff --git a/app/components/MyTickets/graphql/myTickets.gql b/app/components/MyTickets/graphql/myTickets.gql index f7b178c..1039f9e 100644 --- a/app/components/MyTickets/graphql/myTickets.gql +++ b/app/components/MyTickets/graphql/myTickets.gql @@ -5,6 +5,20 @@ query myTickets($input: PaginatedInputMyTicketsSearchValues!) { id paymentStatus redemptionStatus + ticketTemplate { + id + name + } + purchaseOrder { + id + currency { + id + currency + validPaymentMethods + } + finalPrice + status + } } pagination { currentPage diff --git a/app/routes/_authenticated/tickets/index.tsx b/app/routes/_authenticated/tickets/index.tsx index 5a1dd5a..cbf973d 100644 --- a/app/routes/_authenticated/tickets/index.tsx +++ b/app/routes/_authenticated/tickets/index.tsx @@ -1,9 +1,13 @@ +import { MyTickets } from "~/components/MyTickets/MyTickets"; import { sharedLayoutStyle } from "~/components/sharedLayouts"; export default function Layout() { return (
-

Mis Tickets

+
+

Mis Tickets

+ +
); } diff --git a/codegen.ts b/codegen.ts index 08788b0..a3f0eec 100644 --- a/codegen.ts +++ b/codegen.ts @@ -23,7 +23,12 @@ const config = { config: { useTypeImports: true, skipTypename: true, - avoidOptionals: true, + avoidOptionals: { + field: true, + object: false, + inputValue: false, + defaultValue: false, + }, nonOptionalTypename: false, // Lamentablemente, code-gen establece "any" como predeterminado, cuando no tiene un // tipo para un "scalar". Esta opciĆ³n nos obliga a definir un tipo cada vez que