-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: Remove trpc/server dependency from @calcom/atoms #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cursor_combined_20260121_qodo_grep_cursor_copilot_1_base_refactor_remove_trpc_server_dependency_from_calcom_atoms_pr716
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,17 @@ import type { | |
| ApiSuccessResponseWithoutData, | ||
| RoutingFormSearchParams, | ||
| } from "@calcom/platform-types"; | ||
| import type { Slot } from "@calcom/trpc/server/routers/viewer/slots/types"; | ||
|
|
||
| import type { UseCreateBookingInput } from "../hooks/bookings/useCreateBooking"; | ||
|
|
||
| export type Slot = { | ||
| time: string; | ||
| userIds?: string[]; | ||
| attendees?: number; | ||
| bookingUid?: string; | ||
| users?: string[]; | ||
| }; | ||
|
|
||
| // Type that includes only the data values from BookerStore (excluding functions) | ||
| export type BookerStoreValues = Omit< | ||
| BookerStore, | ||
|
|
@@ -104,3 +111,26 @@ export type BookerPlatformWrapperAtomPropsForTeam = BookerPlatformWrapperAtomPro | |
| routingFormSearchParams?: RoutingFormSearchParams; | ||
| rrHostSubsetIds?: number[]; | ||
| }; | ||
|
|
||
| type SlotInfo = { | ||
| time: string; | ||
| attendees?: number; | ||
| bookingUid?: string; | ||
| away?: boolean; | ||
| fromUser?: { | ||
| id: string; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SlotInfo fromUser.id type changed from number to stringMedium Severity The |
||
| displayName: string | null; | ||
| }; | ||
| toUser?: { | ||
| id: number; | ||
| username: string | null; | ||
| displayName: string | null; | ||
| }; | ||
| reason?: string; | ||
| emoji?: string; | ||
| showNotePublicly?: boolean; | ||
| }; | ||
|
|
||
| export type GetAvailableSlotsResponse = { | ||
| slots: Record<string, SlotInfo[]>; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| type Schedule = { | ||
| id: number; | ||
| userId: number; | ||
| name: string; | ||
| timeZone: string | null; | ||
| }; | ||
|
|
||
| export type CreateScheduleHandlerReturn = { | ||
| schedule: Schedule; | ||
| }; | ||
|
|
||
| export type DuplicateScheduleHandlerReturn = { | ||
| schedule: Schedule; | ||
| }; | ||
|
|
||
| export type GetAvailabilityListHandlerReturn = { | ||
| schedules: (Omit<Schedule, "userId"> & { | ||
| availability: { | ||
| id: number; | ||
| userId: number | null; | ||
| eventTypeId: number | null; | ||
| days: string[]; | ||
| startTime: Date; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Availability days type changed from number[] to string[]Medium Severity The |
||
| endTime: Date; | ||
| date: Date | null; | ||
| scheduleId: number | null; | ||
| }[]; | ||
| isDefault: boolean; | ||
| })[]; | ||
| }; | ||
|
|
||
| export type CreateScheduleInput = { | ||
| name: string; | ||
| schedule?: { start: Date; end: Date }[][]; | ||
| eventTypeId?: number; | ||
| }; | ||
|
|
||
| export function validateCreateScheduleInput(input: unknown): CreateScheduleInput { | ||
| if (!input || typeof input !== 'object') { | ||
| throw new Error('Invalid input: must be an object'); | ||
| } | ||
|
|
||
| const data = input as Record<string, unknown>; | ||
|
|
||
| if (typeof data.name !== 'string' || data.name.length === 0) { | ||
| throw new Error('Invalid input: name must be a non-empty string'); | ||
| } | ||
|
|
||
| return data as CreateScheduleInput; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slot userIds type changed from number[] to string[]
Medium Severity
The
Slottype definesuserIdsasstring[], but user IDs throughout the codebase are numbers. The original type in@calcom/trpc/server/routers/viewer/slots/typescorrectly defineduserIds?: number[]. The slot generation code inpackages/features/schedules/lib/slots.tsexplicitly usesuserIds?: number[]in its type definitions and return values. This type mismatch will cause TypeScript type errors when consuming code expects numeric user IDs.