Files
calendar/packages/lib/server/repository/SelectedCalendarRepository.interface.ts
T
Volnei MunhozGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2c8ff89fac perf: Calendar Cache Improvements (#25502)
* wip

* Filter only selectedCalendars where ff is enabled

* test: fix and add tests for calendar subscription cache feature

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>

* test: fix SelectedCalendarRepository tests for new teamIds parameter

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-12-02 08:11:52 -03:00

65 lines
1.5 KiB
TypeScript

import type { Prisma, SelectedCalendar } from "@calcom/prisma/client";
export interface ISelectedCalendarRepository {
/**
* Find selected calendar by id
*
* @param id
*/
findById(id: string): Promise<SelectedCalendar | null>;
/**
* Find selected calendar by channel id
*
* @param channelId
*/
findByChannelId(channelId: string): Promise<SelectedCalendar | null>;
/**
* Find next batch of selected calendars
* Will check if syncSubscribedAt is null or channelExpiration is greater than current date
*
* @param take the number of calendars to take
* @param integrations the list of integrations
*/
findNextSubscriptionBatch({
take,
teamIds,
integrations,
}: {
take: number;
teamIds: number[];
integrations?: string[];
}): Promise<SelectedCalendar[]>;
/**
* Update status of sync for selected calendar
*
* @param id
* @param data
*/
updateSyncStatus(
id: string,
data: Pick<
Prisma.SelectedCalendarUpdateInput,
"syncToken" | "syncedAt" | "syncErrorAt" | "syncErrorCount"
>
): Promise<SelectedCalendar>;
/**
* Update subscription status for selected calendar
*/
updateSubscription(
id: string,
data: Pick<
Prisma.SelectedCalendarUpdateInput,
| "channelId"
| "channelResourceId"
| "channelResourceUri"
| "channelKind"
| "channelExpiration"
| "syncSubscribedAt"
>
): Promise<SelectedCalendar>;
}