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.

16 lines
599 B

  1. import { plainToInstance } from 'class-transformer'
  2. import ApiService from '@/services/api.service'
  3. import { CatalogRepository } from '@/domain/models/upload/catalogRepository'
  4. import { Catalog } from '~/domain/models/upload/catalog'
  5. export class APICatalogRepository implements CatalogRepository {
  6. constructor(
  7. private readonly request = ApiService
  8. ) {}
  9. async list(projectId: string): Promise<Catalog[]> {
  10. const url = `/projects/${projectId}/catalog`
  11. const response = await this.request.get(url)
  12. return response.data.map((item: any) => plainToInstance(Catalog, item))
  13. }
  14. }