Browse Source

Remove download format application service

pull/2144/head
Hironsan 1 year ago
parent
commit
152a9241b3
6 changed files with 5 additions and 38 deletions
  1. 5
      frontend/domain/models/download/downloadFormatRepository.ts
  2. 8
      frontend/pages/projects/_id/dataset/export.vue
  3. 3
      frontend/plugins/services.ts
  4. 3
      frontend/repositories/download/apiDownloadFormatRepository.ts
  5. 11
      frontend/services/application/download/downloadFormatApplicationService.ts
  6. 13
      frontend/services/application/download/formatData.ts

5
frontend/domain/models/download/downloadFormatRepository.ts

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

8
frontend/pages/projects/_id/dataset/export.vue

@ -39,7 +39,7 @@
<script lang="ts">
import Vue from 'vue'
import { fileFormatRules } from '@/rules/index'
import { FormatDTO } from '~/services/application/download/formatData'
import { Format } from '~/domain/models/download/format'
export default Vue.extend({
layout: 'project',
@ -53,7 +53,7 @@ export default Vue.extend({
exportApproved: false,
file: null,
fileFormatRules,
formats: [] as FormatDTO[],
formats: [] as Format[],
isProcessing: false,
polling: null,
selectedFormat: null as any,
@ -68,13 +68,13 @@ export default Vue.extend({
},
example(): string {
const item = this.formats.find((item: FormatDTO) => item.name === this.selectedFormat)
const item = this.formats.find((item: Format) => item.name === this.selectedFormat)
return item!.example.trim()
}
},
async created() {
this.formats = await this.$services.downloadFormat.list(this.projectId)
this.formats = await this.$repositories.downloadFormat.list(this.projectId)
},
beforeDestroy() {

3
frontend/plugins/services.ts

@ -3,7 +3,6 @@ import { repositories } from './repositories'
import { ConfigApplicationService } from '@/services/application/autoLabeling/configApplicationService'
import { CommentApplicationService } from '@/services/application/comment/commentApplicationService'
import { DownloadApplicationService } from '@/services/application/download/downloadApplicationService'
import { DownloadFormatApplicationService } from '@/services/application/download/downloadFormatApplicationService'
import { ExampleApplicationService } from '@/services/application/example/exampleApplicationService'
import { LabelApplicationService } from '@/services/application/label/labelApplicationService'
import { MemberApplicationService } from '@/services/application/member/memberApplicationService'
@ -29,7 +28,6 @@ export interface Services {
seq2seq: Seq2seqApplicationService
option: OptionApplicationService
config: ConfigApplicationService
downloadFormat: DownloadFormatApplicationService
download: DownloadApplicationService
tag: TagApplicationService
bbox: BoundingBoxApplicationService
@ -59,7 +57,6 @@ const plugin: Plugin = (_, inject) => {
seq2seq: new Seq2seqApplicationService(repositories.textLabel),
option: new OptionApplicationService(repositories.option),
config: new ConfigApplicationService(repositories.config),
downloadFormat: new DownloadFormatApplicationService(repositories.downloadFormat),
download: new DownloadApplicationService(repositories.download),
tag: new TagApplicationService(repositories.tag),
bbox: new BoundingBoxApplicationService(repositories.boundingBox),

3
frontend/repositories/download/apiDownloadFormatRepository.ts

@ -1,9 +1,8 @@
import { plainToInstance } from 'class-transformer'
import ApiService from '@/services/api.service'
import { DownloadFormatRepository } from '@/domain/models/download/downloadFormatRepository'
import { Format } from '~/domain/models/download/format'
export class APIDownloadFormatRepository implements DownloadFormatRepository {
export class APIDownloadFormatRepository {
constructor(private readonly request = ApiService) {}
async list(projectId: string): Promise<Format[]> {

11
frontend/services/application/download/downloadFormatApplicationService.ts

@ -1,11 +0,0 @@
import { FormatDTO } from './formatData'
import { DownloadFormatRepository } from '~/domain/models/download/downloadFormatRepository'
export class DownloadFormatApplicationService {
constructor(private readonly repository: DownloadFormatRepository) {}
public async list(projectId: string): Promise<FormatDTO[]> {
const items = await this.repository.list(projectId)
return items.map((item) => new FormatDTO(item))
}
}

13
frontend/services/application/download/formatData.ts

@ -1,13 +0,0 @@
import { Format } from '~/domain/models/download/format'
export class FormatDTO {
name: string
example: string
properties: object
constructor(item: Format) {
this.name = item.name
this.example = item.example
this.properties = item.properties
}
}
Loading…
Cancel
Save