Skip to content

Commit 7b32c6a

Browse files
committed
New Post Schema
1 parent 8000c22 commit 7b32c6a

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

src/routes/paidEvents.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,36 @@ type EventDeleteRequest = {
3737
Body: undefined;
3838
};
3939

40-
export const postTicketSchema = z.object({
40+
const TicketPostSchema = z.object({
4141
event_id: z.string(),
4242
event_name: z.string(),
43-
eventCost: z.record(z.number()),
44-
eventDetails: z.optional(z.string()),
45-
eventImage: z.optional(z.string()),
46-
eventProps: z.optional(z.record(z.string(), z.string())),
43+
eventCost: z.optional(z.record(z.number())),
44+
eventDetails: z.string(),
45+
eventImage: z.string(),
4746
event_capacity: z.number(),
48-
event_sales_active_utc: z.string(),
47+
event_sales_active_utc: z.number(),
4948
event_time: z.number(),
5049
member_price: z.optional(z.string()),
5150
nonmember_price: z.optional(z.string()),
5251
tickets_sold: z.number(),
5352
});
5453

55-
type TicketPostSchema = z.infer<typeof postTicketSchema>;
54+
const MerchPostSchema = z.object({
55+
item_id: z.string(),
56+
item_email_desc: z.string(),
57+
item_image: z.string(),
58+
item_name: z.string(),
59+
item_price: z.optional(z.record(z.string(), z.number())),
60+
item_sales_active_utc: z.number(),
61+
limit_per_person: z.number(),
62+
member_price: z.string(),
63+
nonmember_price: z.string(),
64+
ready_for_pickup: z.boolean(),
65+
sizes: z.optional(z.array(z.string())),
66+
total_avail: z.optional(z.record(z.string(), z.string())),
67+
});
68+
69+
type TicketPostSchema = z.infer<typeof TicketPostSchema>;
5670

5771
const responseJsonSchema = zodToJsonSchema(
5872
z.object({
@@ -300,7 +314,7 @@ const paidEventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
300314
response: { 200: responseJsonSchema },
301315
},
302316
preValidation: async (request, reply) => {
303-
await fastify.zodValidateBody(request, reply, postTicketSchema);
317+
await fastify.zodValidateBody(request, reply, TicketPostSchema);
304318
},
305319
/*onRequest: async (request, reply) => {
306320
await fastify.authorize(request, reply, [AppRoles.EVENTS_MANAGER]);
@@ -324,6 +338,8 @@ const paidEventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
324338
}
325339
const entry = {
326340
...request.body,
341+
member_price: "Send to stripe API",
342+
nonmember_price: "Send to stripe API",
327343
};
328344
await dynamoclient.send(
329345
new PutItemCommand({

0 commit comments

Comments
 (0)