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.

37 lines
1.4 KiB

2 years ago
  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(private readonly request = ApiService) {}
  6. async fetchCategoryDistribution(projectId: string): Promise<Distribution> {
  7. const url = `/projects/${projectId}/metrics/category-distribution`
  8. const response = await this.request.get(url)
  9. return response.data
  10. }
  11. async fetchSpanDistribution(projectId: string): Promise<Distribution> {
  12. const url = `/projects/${projectId}/metrics/span-distribution`
  13. const response = await this.request.get(url)
  14. return response.data
  15. }
  16. async fetchRelationDistribution(projectId: string): Promise<Distribution> {
  17. const url = `/projects/${projectId}/metrics/relation-distribution`
  18. const response = await this.request.get(url)
  19. return response.data
  20. }
  21. async fetchMemberProgress(projectId: string): Promise<Progress> {
  22. const url = `/projects/${projectId}/metrics/member-progress`
  23. const response = await this.request.get(url)
  24. return response.data
  25. }
  26. async fetchMyProgress(projectId: string): Promise<MyProgress> {
  27. const url = `/projects/${projectId}/metrics/progress`
  28. const response = await this.request.get(url)
  29. return response.data
  30. }
  31. }