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.
 
 
 
 
 
 

54 lines
1.5 KiB

import { ConfigRepository, ConfigTestResponse } from '~/domain/models/autoLabeling/configRepository'
import { ConfigItemList, ConfigItem } from '~/domain/models/autoLabeling/config'
export class ConfigApplicationService {
constructor(
private readonly configRepository: ConfigRepository
) {}
public list(id: string): Promise<ConfigItemList> {
return this.configRepository.list(id)
}
public save(projectId: string, item: ConfigItem): Promise<ConfigItem> {
return this.configRepository.create(projectId, item)
}
public delete(projectId: string, itemId: number) {
return this.configRepository.delete(projectId, itemId)
}
public testParameters(projectId: string, item: ConfigItem, text: string) {
return this.configRepository.testParameters(projectId, item, text)
.then((value) => {
return value
})
.catch((error) => {
const data = error.response.data
throw new Error(data)
})
}
public testTemplate(projectId: string, response: any, item: ConfigItem) {
return this.configRepository.testTemplate(projectId, response, item)
.then((value) => {
return value
})
.catch((error) => {
const data = error.response.data
throw new Error(data)
})
}
public testMapping(projectId: string, item: ConfigItem, response: any) {
return this.configRepository.testMapping(projectId, item, response)
.then((value) => {
return value
})
.catch((error) => {
const data = error.response.data
throw new Error(data)
})
}
}