* feat: add CalendarsTasker with sync and trigger.dev versions This PR implements a CalendarsTasker following the same pattern as PlatformOrganizationBillingTasker to replace the logic in apps/api/v2/src/ee/calendars/processors/calendars.processor.ts New files created: - CalendarsTasker main orchestrator extending Tasker base class - CalendarsSyncTasker for sync execution - CalendarsTriggerTasker for async execution via trigger.dev - CalendarsTaskService with business logic for ensuring default calendars - trigger.dev task with queue config and retry settings - DI modules using @evyweb/ioctopus - NestJS DI modules for API v2 Co-Authored-By: morgan@cal.com <morgan@cal.com> * fix: import and deasync * style: format trigger.config.ts dirs array Co-Authored-By: unknown <> * refactor: move prisma query to UserRepository and set onboarding to true Co-Authored-By: morgan@cal.com <morgan@cal.com> * refactor: remove credential.key from UserRepository method Co-Authored-By: morgan@cal.com <morgan@cal.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
24 lines
784 B
TypeScript
24 lines
784 B
TypeScript
import type { ITaskerDependencies } from "@calcom/lib/tasker/types";
|
|
import { nanoid } from "nanoid";
|
|
|
|
import type { CalendarsTaskService } from "./CalendarsTaskService";
|
|
import type { ICalendarsTasker } from "./types";
|
|
|
|
export interface ICalendarsSyncTaskerDependencies {
|
|
calendarsTaskService: CalendarsTaskService;
|
|
}
|
|
|
|
export class CalendarsSyncTasker implements ICalendarsTasker {
|
|
constructor(
|
|
public readonly dependencies: ITaskerDependencies & ICalendarsSyncTaskerDependencies
|
|
) {}
|
|
|
|
async ensureDefaultCalendars(
|
|
payload: Parameters<ICalendarsTasker["ensureDefaultCalendars"]>[0]
|
|
): Promise<{ runId: string }> {
|
|
const runId = `sync_${nanoid(10)}`;
|
|
await this.dependencies.calendarsTaskService.ensureDefaultCalendars(payload);
|
|
return { runId };
|
|
}
|
|
}
|