Browse Source

Remove catalog application service

pull/2144/head
Hironsan 2 years ago
parent
commit
aa41209b7a
6 changed files with 2 additions and 41 deletions
  1. 5
      frontend/domain/models/upload/catalogRepository.ts
  2. 2
      frontend/pages/projects/_id/dataset/import.vue
  3. 3
      frontend/plugins/services.ts
  4. 3
      frontend/repositories/upload/apiCatalogRepository.ts
  5. 11
      frontend/services/application/upload/catalogApplicationService.ts
  6. 19
      frontend/services/application/upload/catalogData.ts

5
frontend/domain/models/upload/catalogRepository.ts

@ -1,5 +0,0 @@
import { Catalog } from './catalog'
export interface CatalogRepository {
list(projectId: string): Promise<Catalog[]>
}

2
frontend/pages/projects/_id/dataset/import.vue

@ -210,7 +210,7 @@ export default {
},
async created() {
this.catalog = await this.$services.catalog.list(this.$route.params.id)
this.catalog = await this.$repositories.catalog.list(this.$route.params.id)
this.pollData()
},

3
frontend/plugins/services.ts

@ -15,7 +15,6 @@ import { SegmentationApplicationService } from '@/services/application/tasks/seg
import { Seq2seqApplicationService } from '@/services/application/tasks/seq2seq/seq2seqApplicationService'
import { SequenceLabelingApplicationService } from '@/services/application/tasks/sequenceLabeling/sequenceLabelingApplicationService'
import { TextClassificationService } from '@/services/application/tasks/textClassification/textClassificationApplicationService'
import { CatalogApplicationService } from '@/services/application/upload/catalogApplicationService'
import { ParseApplicationService } from '@/services/application/upload/parseApplicationService'
export interface Services {
@ -31,7 +30,6 @@ export interface Services {
seq2seq: Seq2seqApplicationService
option: OptionApplicationService
config: ConfigApplicationService
catalog: CatalogApplicationService
parse: ParseApplicationService
downloadFormat: DownloadFormatApplicationService
download: DownloadApplicationService
@ -63,7 +61,6 @@ const plugin: Plugin = (_, inject) => {
seq2seq: new Seq2seqApplicationService(repositories.textLabel),
option: new OptionApplicationService(repositories.option),
config: new ConfigApplicationService(repositories.config),
catalog: new CatalogApplicationService(repositories.catalog),
parse: new ParseApplicationService(repositories.parse),
downloadFormat: new DownloadFormatApplicationService(repositories.downloadFormat),
download: new DownloadApplicationService(repositories.download),

3
frontend/repositories/upload/apiCatalogRepository.ts

@ -1,5 +1,4 @@
import ApiService from '@/services/api.service'
import { CatalogRepository } from '@/domain/models/upload/catalogRepository'
import { Catalog } from '~/domain/models/upload/catalog'
function toModel(item: { [key: string]: any }): Catalog {
@ -13,7 +12,7 @@ function toModel(item: { [key: string]: any }): Catalog {
)
}
export class APICatalogRepository implements CatalogRepository {
export class APICatalogRepository {
constructor(private readonly request = ApiService) {}
async list(projectId: string): Promise<Catalog[]> {

11
frontend/services/application/upload/catalogApplicationService.ts

@ -1,11 +0,0 @@
import { CatalogDTO } from './catalogData'
import { CatalogRepository } from '~/domain/models/upload/catalogRepository'
export class CatalogApplicationService {
constructor(private readonly repository: CatalogRepository) {}
public async list(projectId: string): Promise<CatalogDTO[]> {
const items = await this.repository.list(projectId)
return items.map((item) => new CatalogDTO(item))
}
}

19
frontend/services/application/upload/catalogData.ts

@ -1,19 +0,0 @@
import { Catalog } from '~/domain/models/upload/catalog'
export class CatalogDTO {
name: string
example: string
acceptTypes: string
properties: object
taskId: string
displayName: string
constructor(item: Catalog) {
this.name = item.name
this.example = item.example
this.acceptTypes = item.acceptTypes
this.properties = item.properties
this.displayName = item.displayName
this.taskId = item.taskId
}
}
Loading…
Cancel
Save