Files
calendar/packages/features/insights/server/raw-data.schema.ts
T
devin-ai-integration[bot]GitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>eunjae@cal.com <eunjae@cal.com>Eunjae Lee
e29f6af540 feat(insights): add progress indicator to download button on /insights and /insights/routing (CAL-5408) (#20631)
* feat(insights): add progress indicator to routing form responses download button (CAL-5408)

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* fix: address PR feedback - remove initial progress update and ensure no decimal parts in percentage

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* feat(insights): add progress indicator to Download component

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* feat: paginate rawData endpoint and implement batch fetching in Download component

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* refactor: simplify pagination logic in trpc-router.ts

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* show progress on tooltip

* fix download for /insights

* fix download when there is no data

* feat: replace tooltip progress indicator with toast notification

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* fix: remove duplicate ProgressToast component from showToast.tsx

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* fix: export ProgressToast component from index.ts

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* fix: add missing translation for downloading_data

Co-Authored-By: eunjae@cal.com <eunjae@cal.com>

* update progress toast implementation

* fix error

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: eunjae@cal.com <eunjae@cal.com>
Co-authored-by: Eunjae Lee <hey@eunjae.dev>
2025-04-23 15:59:09 +02:00

64 lines
1.8 KiB
TypeScript

import z from "zod";
import { ZColumnFilter, ZSorting } from "@calcom/features/data-table/lib/types";
import type { ColumnFilter, Sorting } from "@calcom/features/data-table/lib/types";
export type RawDataInput = {
startDate: string;
endDate: string;
teamId?: number | null;
userId?: number | null;
memberUserId?: number | null;
isAll?: boolean;
eventTypeId?: number | null;
offset?: number;
limit?: number;
};
export const rawDataInputSchema = z.object({
startDate: z.string(),
endDate: z.string(),
teamId: z.coerce.number().optional().nullable(),
userId: z.coerce.number().optional().nullable(),
memberUserId: z.coerce.number().optional().nullable(),
isAll: z.boolean().optional(),
eventTypeId: z.coerce.number().optional().nullable(),
offset: z.number().optional(),
limit: z.number().max(100).optional(),
}) satisfies z.ZodType<RawDataInput>;
export type RoutingFormStatsInput = {
startDate: string;
endDate: string;
teamId?: number;
userId?: number;
memberUserIds?: number[];
isAll: boolean;
routingFormId?: string;
columnFilters: ColumnFilter[];
sorting?: Sorting[];
};
export type RoutingFormResponsesInput = RoutingFormStatsInput & {
offset?: number;
limit?: number;
};
export const routingFormStatsInputSchema = z.object({
startDate: z.string(),
endDate: z.string(),
teamId: z.coerce.number().optional(),
userId: z.coerce.number().optional(),
memberUserIds: z.number().array().optional(),
isAll: z.coerce.boolean(),
routingFormId: z.string().optional(),
columnFilters: z.array(ZColumnFilter),
sorting: z.array(ZSorting).optional(),
}) satisfies z.ZodType<RoutingFormStatsInput>;
export const routingFormResponsesInputSchema = z.object({
...routingFormStatsInputSchema.shape,
offset: z.number().optional(),
limit: z.number().max(100).optional(),
}) satisfies z.ZodType<RoutingFormResponsesInput>;