Skip to content

Commit ff0da12

Browse files
committed
give more data to the ticket listing endpoint
1 parent b217f7a commit ff0da12

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/routes/tickets.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,19 @@ const ticketEntryZod = z.object({
4848
purchaserData: purchaseSchema,
4949
});
5050

51+
const ticketInfoEntryZod = ticketEntryZod.extend({
52+
refunded: z.boolean(),
53+
fulfilled: z.boolean(),
54+
});
55+
5156
type TicketEntry = z.infer<typeof ticketEntryZod>;
57+
type TicketInfoEntry = z.infer<typeof ticketInfoEntryZod>;
5258

5359
const responseJsonSchema = zodToJsonSchema(ticketEntryZod);
5460

5561
const getTicketsResponseJsonSchema = zodToJsonSchema(
5662
z.object({
57-
tickets: z.array(ticketEntryZod),
63+
tickets: z.array(ticketInfoEntryZod),
5864
}),
5965
);
6066

@@ -97,7 +103,7 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
97103
async (request, reply) => {
98104
const eventId = (request.params as Record<string, string>).eventId;
99105
const eventType = request.query?.type;
100-
const issuedTickets: TicketEntry[] = [];
106+
const issuedTickets: TicketInfoEntry[] = [];
101107
switch (eventType) {
102108
case "merch":
103109
const command = new QueryCommand({
@@ -120,6 +126,8 @@ const ticketsPlugin: FastifyPluginAsync = async (fastify, _options) => {
120126
type: "merch",
121127
valid: true,
122128
ticketId: unmarshalled["stripe_pi"],
129+
refunded: unmarshalled["refunded"],
130+
fulfilled: unmarshalled["fulfilled"],
123131
purchaserData: {
124132
email: unmarshalled["email"],
125133
productId: eventId,

0 commit comments

Comments
 (0)