diff --git a/frontend/domain/models/metrics/metrics.ts b/frontend/domain/models/metrics/metrics.ts index 5e420e1c..0a4c2747 100644 --- a/frontend/domain/models/metrics/metrics.ts +++ b/frontend/domain/models/metrics/metrics.ts @@ -6,3 +6,9 @@ export interface Progress { total: number progress: {user: string, done: number}[] } + +export interface MyProgress { + total: number + complete: number + remaining: number +} diff --git a/frontend/domain/models/metrics/metricsRepository.ts b/frontend/domain/models/metrics/metricsRepository.ts index c0cc37c5..d5168f11 100644 --- a/frontend/domain/models/metrics/metricsRepository.ts +++ b/frontend/domain/models/metrics/metricsRepository.ts @@ -1,7 +1,8 @@ -import { Distribution, Progress } from '~/domain/models/metrics/metrics' +import { Distribution, Progress, MyProgress } from '~/domain/models/metrics/metrics' export interface MetricsRepository { fetchCategoryDistribution(projectId: string): Promise fetchSpanDistribution(projectId: string): Promise fetchMemberProgress(projectId: string): Promise + fetchMyProgress(projectId: string): Promise } diff --git a/frontend/repositories/metrics/apiMetricsRepository.ts b/frontend/repositories/metrics/apiMetricsRepository.ts index 1897b4df..1705df80 100644 --- a/frontend/repositories/metrics/apiMetricsRepository.ts +++ b/frontend/repositories/metrics/apiMetricsRepository.ts @@ -1,6 +1,6 @@ import ApiService from '@/services/api.service' import { MetricsRepository } from '@/domain/models/metrics/metricsRepository' -import { Distribution, Progress } from '~/domain/models/metrics/metrics' +import { Distribution, Progress, MyProgress } from '~/domain/models/metrics/metrics' export class APIMetricsRepository implements MetricsRepository { constructor( @@ -24,4 +24,10 @@ export class APIMetricsRepository implements MetricsRepository { const response = await this.request.get(url) return response.data } + + async fetchMyProgress(projectId: string): Promise { + const url = `/projects/${projectId}/metrics/progress` + const response = await this.request.get(url) + return response.data + } } diff --git a/frontend/services/application/metrics/metricsApplicationService.ts b/frontend/services/application/metrics/metricsApplicationService.ts index 2b0f006a..eb3ab0af 100644 --- a/frontend/services/application/metrics/metricsApplicationService.ts +++ b/frontend/services/application/metrics/metricsApplicationService.ts @@ -1,5 +1,5 @@ import { MetricsRepository } from '~/domain/models/metrics/metricsRepository' -import { Progress, Distribution } from '~/domain/models/metrics/metrics' +import { Progress, Distribution, MyProgress } from '~/domain/models/metrics/metrics' export class MetricsApplicationService { constructor( @@ -17,4 +17,8 @@ export class MetricsApplicationService { public async fetchSpanDistribution(projectId: string): Promise { return await this.repository.fetchSpanDistribution(projectId) } + + public async fetchMyProgress(projectId: string): Promise { + return await this.repository.fetchMyProgress(projectId) + } }