Skip to content

Commit

Permalink
New mutation examples
Browse files Browse the repository at this point in the history
  • Loading branch information
fforres committed Apr 3, 2024
1 parent 1376ad5 commit a8a09bb
Showing 1 changed file with 127 additions and 43 deletions.
170 changes: 127 additions & 43 deletions app/(transition)/graphiql/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,47 @@ mutation CrearEvento($input: EventCreateInput!) {
endDateTime
}
}`;

const mutacionCrearTicket = `# Esta mutación requiere que seas Admin de una Comunidad.
# Puedes permirle permisos al Admin de alguna comunidad
# para que te haga admin
mutation CrearTicket($input: TicketCreateInput!) {
createTicket(input: $input) {
id
description
startDateTime
endDateTime
}
}`;

const mutacionDeCreatePurchaseOrder = `mutation claimUserTicket($input: TicketClaimInput!) {
claimUserTicket(input: $input) {
__typename
... on PurchaseOrder {
__typename
id
currency {
id
}
finalPrice
paymentLink
status
tickets {
id
approvalStatus
status
redemptionStatus
paymentStatus
}
}
... on RedeemUserTicketError {
__typename
error
errorMessage
}
}
}`;

export default function Pregunta() {
const [isLoaded, setIsLoaded] = useState(false);
const [isLoggedIn, setIsLoggedIn] = useState(false);
Expand Down Expand Up @@ -148,51 +189,94 @@ export default function Pregunta() {
);
}
return (
<GraphiQL
fetcher={fetcherRef.current}
defaultEditorToolsVisibility="variables"
defaultTabs={[
{
query: comunidades,
},
{
query: comunidadesUsuariosYEventos,
},
{
query: comunidadesYEventos,
},
{
query: mutacionCrearComunidad,
variables: JSON.stringify(
{
input: {
description: "",
name: "",
slug: "",
<div className="h-[100svh]">
<GraphiQL
fetcher={fetcherRef.current}
defaultEditorToolsVisibility="variables"
defaultTabs={[
{
query: comunidades,
},
{
query: comunidadesUsuariosYEventos,
},
{
query: comunidadesYEventos,
},
{
query: mutacionCrearComunidad,
variables: JSON.stringify(
{
input: {
description: "",
name: "",
slug: "",
},
},
},
null,
2,
),
},
{
query: mutacionCrearEvento,
variables: JSON.stringify(
{
input: {
communityId: "",
description: "",
maxAttendees: 0,
name: "",
startDateTime: "",
null,
2,
),
},
{
query: mutacionCrearEvento,
variables: JSON.stringify(
{
input: {
communityId: "",
description: "",
maxAttendees: 0,
name: "",
startDateTime: "",
},
},
null,
2,
),
},
{
query: mutacionCrearTicket,
variables: JSON.stringify(
{
input: {
eventId: "f8cc358c-a0e5-4ae3-a6e6-d4bf92102f6a",
isFree: false,
name: "Ticket 1",
prices: [
{
currencyId: "71c3b512-f471-4710-a55c-43b8563825fe",
value: 20,
},
],
startDateTime: "2030-04-03T12:50:31.857Z",
unlimitedTickets: false,
quantity: 20,
},
},
},
null,
2,
),
},
]}
/>
null,
2,
),
},
{
query: mutacionDeCreatePurchaseOrder,
variables: JSON.stringify(
{
input: {
idempotencyUUIDKey: "13a5143e-74b3-4f2a-b1ee-4780ae1086da",
purchaseOrder: [
{
quantity: 2,
ticketId: "f7a0f051-b739-4d44-b4b1-1f14e7cf33bd",
},
],
},
},
null,
2,
),
},
]}
/>
</div>
);
}

Expand Down

0 comments on commit a8a09bb

Please sign in to comment.