Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🚀 Update API interface (#2154)
Luke Vellafeabbd750fe1
diff --git a/apps/web/src/app/api/private/[...route]/route.test.ts b/apps/web/src/app/api/private/[...route]/route.test.tsindex d55fb306e..7509bd0f3 100644--- a/apps/web/src/app/api/private/[...route]/route.test.ts+++ b/apps/web/src/app/api/private/[...route]/route.test.ts@@ -394,13 +394,15 @@ describe("Private API - /polls", () => {slots: {duration: 30,timezone: "Europe/London",- times: {- startDate: "2025-01-20",- endDate: "2025-01-22",- days: ["mon", "tue", "wed"],- startTime: "09:00",- endTime: "10:00",- },+ times: [+ {+ startDate: "2025-01-20",+ endDate: "2025-01-22",+ days: ["mon", "tue", "wed"],+ startTime: "09:00",+ endTime: "10:00",+ },+ ],},}),});diff --git a/apps/web/src/app/api/private/schemas.ts b/apps/web/src/app/api/private/schemas.tsindex a3c5b8142..6c57220f0 100644--- a/apps/web/src/app/api/private/schemas.ts+++ b/apps/web/src/app/api/private/schemas.ts@@ -25,14 +25,6 @@ export const slotGeneratorSchema = z}).openapi("SlotGenerator");-const timeOptionSchema = z.union([- z.iso.datetime().openapi({- description: "ISO datetime start time",- example: "2025-01-15T09:00:00Z",- }),- slotGeneratorSchema,-]);-const slotsInputSchema = z.object({duration: z.number().int().min(15).max(1440).openapi({@@ -51,10 +43,19 @@ const slotsInputSchema = zexample: "Europe/London",}),times: z- .union([slotGeneratorSchema, z.array(timeOptionSchema).min(1)])+ .array(+ z.union([+ z.iso.datetime().openapi({+ description: "ISO datetime start time",+ example: "2025-01-15T09:00:00Z",+ }),+ slotGeneratorSchema,+ ]),+ )+ .min(1).openapi({description:- "Times to include. Can be a slot generator or an array of ISO datetime strings and/or slot generators.",+ "Times to include. An array of ISO datetime strings and/or slot generators.",}),}).openapi("SlotsInput");diff --git a/apps/web/src/app/api/private/utils/time-slots.ts b/apps/web/src/app/api/private/utils/time-slots.tsindex ee42a0bce..c61726c10 100644--- a/apps/web/src/app/api/private/utils/time-slots.ts+++ b/apps/web/src/app/api/private/utils/time-slots.ts@@ -78,20 +78,6 @@ export const generateTimeSlots = (const startDay = dayjs.utc(generator.startDate).startOf("day");const endDay = dayjs.utc(generator.endDate).startOf("day");- const from = parseLocalDateTimeInTimeZone(- generator.startDate,- generator.fromTime,- timeZone,- );- const to = parseLocalDateTimeInTimeZone(- generator.startDate,- generator.toTime,- timeZone,- );- if (!to.isAfter(from)) {- return [];- }-const results: Array<TimeSlot> = [];for (