Browse Source

Add stats repository

pull/1235/head
Hironsan 3 years ago
parent
commit
e697b76235
2 changed files with 21 additions and 0 deletions
  1. 15
      frontend/repositories/statistics/api.ts
  2. 6
      frontend/repositories/statistics/interface.ts

15
frontend/repositories/statistics/api.ts

@ -0,0 +1,15 @@
import ApiService from '@/services/api.service'
import { Statistics } from '@/models/statistics'
import { StatisticsRepository } from './interface'
export class FromApiStatisticsRepository implements StatisticsRepository {
constructor(
private readonly request = ApiService
) {}
async fetch(projectId: string): Promise<Statistics> {
const url = `/projects/${projectId}/statistics`
const response = await this.request.get(url)
return Statistics.valueOf(response.data)
}
}

6
frontend/repositories/statistics/interface.ts

@ -0,0 +1,6 @@
import { Statistics } from '@/models/statistics'
export interface StatisticsRepository {
fetch(projectId: string): Promise<Statistics>
}
Loading…
Cancel
Save