* chore: Determine to serve cache high level * Fix invalid import * fix: Cache test
17 lines
733 B
TypeScript
17 lines
733 B
TypeScript
import type { IFeaturesRepository } from "@calcom/features/flags/features.repository.interface";
|
|
import { CalendarSubscriptionService } from "@calcom/features/calendar-subscription/lib/CalendarSubscriptionService";
|
|
|
|
export interface ICacheService {
|
|
featuresRepository: IFeaturesRepository;
|
|
}
|
|
|
|
export class CacheService {
|
|
constructor(private readonly dependencies: ICacheService) {}
|
|
|
|
async getShouldServeCache(shouldServeCache?: boolean | undefined, teamId?: number) {
|
|
if (typeof shouldServeCache === "boolean") return shouldServeCache;
|
|
if (!teamId) return false;
|
|
return await this.dependencies.featuresRepository.checkIfTeamHasFeature(teamId, CalendarSubscriptionService.CALENDAR_SUBSCRIPTION_CACHE_FEATURE);
|
|
}
|
|
}
|