mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 20:16:26 +08:00
27 lines
613 B
TypeScript
27 lines
613 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
|
|
import { OnJob } from '../../base';
|
|
import { CalendarService } from './service';
|
|
|
|
declare global {
|
|
interface Jobs {
|
|
'calendar.syncSubscription': {
|
|
subscriptionId: string;
|
|
reason?: 'polling' | 'webhook' | 'on-demand';
|
|
};
|
|
}
|
|
}
|
|
|
|
@Injectable()
|
|
export class CalendarJob {
|
|
constructor(private readonly calendar: CalendarService) {}
|
|
|
|
@OnJob('calendar.syncSubscription')
|
|
async syncSubscription({
|
|
subscriptionId,
|
|
reason,
|
|
}: Jobs['calendar.syncSubscription']) {
|
|
await this.calendar.syncSubscription(subscriptionId, { reason });
|
|
}
|
|
}
|