You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

  1. import ApiService from '@/services/api.service'
  2. import { MetricsRepository } from '@/domain/models/metrics/metricsRepository'
  3. import { Distribution, Progress, MyProgress } from '~/domain/models/metrics/metrics'
  4. export class APIMetricsRepository implements MetricsRepository {
  5. constructor(
  6. private readonly request = ApiService
  7. ) {}
  8. async fetchCategoryDistribution(projectId: string): Promise<Distribution> {
  9. const url = `/projects/${projectId}/metrics/category-distribution`
  10. const response = await this.request.get(url)
  11. return response.data
  12. }
  13. async fetchSpanDistribution(projectId: string): Promise<Distribution> {
  14. const url = `/projects/${projectId}/metrics/span-distribution`
  15. const response = await this.request.get(url)
  16. return response.data
  17. }
  18. async fetchMemberProgress(projectId: string): Promise<Progress> {
  19. const url = `/projects/${projectId}/metrics/member-progress`
  20. const response = await this.request.get(url)
  21. return response.data
  22. }
  23. async fetchMyProgress(projectId: string): Promise<MyProgress> {
  24. const url = `/projects/${projectId}/metrics/progress`
  25. const response = await this.request.get(url)
  26. return response.data
  27. }
  28. }