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.

39 lines
1.4 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 fetchRelationDistribution(projectId: string): Promise<Distribution> {
  19. const url = `/projects/${projectId}/metrics/relation-distribution`
  20. const response = await this.request.get(url)
  21. return response.data
  22. }
  23. async fetchMemberProgress(projectId: string): Promise<Progress> {
  24. const url = `/projects/${projectId}/metrics/member-progress`
  25. const response = await this.request.get(url)
  26. return response.data
  27. }
  28. async fetchMyProgress(projectId: string): Promise<MyProgress> {
  29. const url = `/projects/${projectId}/metrics/progress`
  30. const response = await this.request.get(url)
  31. return response.data
  32. }
  33. }