2022-09-06 11:36:01 +02:00
|
|
|
import type {IFile} from '@/modelTypes/IFile'
|
2020-01-19 20:23:06 +01:00
|
|
|
import AbstractService from '../abstractService'
|
|
|
|
|
|
|
|
// This service builds on top of the abstract service and basically just hides away method names.
|
|
|
|
// It enables migration services to be created with minimal overhead and even better method names.
|
2021-09-04 21:26:38 +02:00
|
|
|
export default class AbstractMigrationFileService extends AbstractService {
|
2020-01-20 22:22:32 +01:00
|
|
|
serviceUrlKey = ''
|
|
|
|
|
2022-09-06 11:36:01 +02:00
|
|
|
constructor(serviceUrlKey: '') {
|
2020-01-19 20:23:06 +01:00
|
|
|
super({
|
2021-09-04 21:26:38 +02:00
|
|
|
create: '/migration/' + serviceUrlKey + '/migrate',
|
2020-01-19 20:23:06 +01:00
|
|
|
})
|
2020-01-20 22:22:32 +01:00
|
|
|
this.serviceUrlKey = serviceUrlKey
|
2020-01-19 20:23:06 +01:00
|
|
|
}
|
|
|
|
|
2020-01-20 22:22:32 +01:00
|
|
|
getStatus() {
|
2020-09-05 22:35:52 +02:00
|
|
|
return this.getM('/migration/' + this.serviceUrlKey + '/status')
|
2020-01-19 20:23:06 +01:00
|
|
|
}
|
2021-09-04 21:26:38 +02:00
|
|
|
|
|
|
|
useCreateInterceptor() {
|
|
|
|
return false
|
|
|
|
}
|
2020-01-19 20:23:06 +01:00
|
|
|
|
2022-09-06 11:36:01 +02:00
|
|
|
migrate(file: IFile) {
|
2021-09-04 21:26:38 +02:00
|
|
|
console.log(file)
|
|
|
|
return this.uploadFile(
|
|
|
|
this.paths.create,
|
|
|
|
file,
|
|
|
|
'import',
|
|
|
|
)
|
2020-01-19 20:23:06 +01:00
|
|
|
}
|
2021-09-04 21:26:38 +02:00
|
|
|
}
|