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.

36 lines
1.3 KiB

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