1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-18 11:14:57 +02:00
unleash.unleash/src/lib/features/project-insights/fake-project-insights-read-model.ts
2024-03-22 09:48:29 +01:00

26 lines
695 B
TypeScript

import type {
ChangeRequestCounts,
IProjectInsightsReadModel,
} from './project-insights-read-model-type';
const changeRequestCounts: ChangeRequestCounts = {
total: 0,
approved: 0,
applied: 0,
rejected: 0,
reviewRequired: 0,
scheduled: 0,
};
export class FakeProjectInsightsReadModel implements IProjectInsightsReadModel {
private counts: Record<string, ChangeRequestCounts> = {};
async getChangeRequests(projectId: string): Promise<ChangeRequestCounts> {
return this.counts[projectId] ?? changeRequestCounts;
}
async setChangeRequests(projectId: string, counts: ChangeRequestCounts) {
this.counts[projectId] = counts;
}
}