1
0

feat: MigrateService script setup (#2432)

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2432
Reviewed-by: konrad <k@knt.li>
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
Dominik Pschenitschni
2022-11-03 14:19:42 +00:00
committed by konrad
parent 0ed7114260
commit 8b7b4d61a3
12 changed files with 105 additions and 111 deletions

View File

@ -1,11 +1,13 @@
import AbstractService from '../abstractService'
export type MigrationConfig = { code: string }
// 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.
export default class AbstractMigrationService extends AbstractService {
export default class AbstractMigrationService extends AbstractService<MigrationConfig> {
serviceUrlKey = ''
constructor(serviceUrlKey) {
constructor(serviceUrlKey: string) {
super({
update: '/migration/' + serviceUrlKey + '/migrate',
})
@ -20,7 +22,7 @@ export default class AbstractMigrationService extends AbstractService {
return this.getM('/migration/' + this.serviceUrlKey + '/status')
}
migrate(data) {
migrate(data: MigrationConfig) {
return this.update(data)
}
}

View File

@ -1,4 +1,3 @@
import type {IFile} from '@/modelTypes/IFile'
import AbstractService from '../abstractService'
// This service builds on top of the abstract service and basically just hides away method names.
@ -21,7 +20,7 @@ export default class AbstractMigrationFileService extends AbstractService {
return false
}
migrate(file: IFile) {
migrate(file: File) {
return this.uploadFile(
this.paths.create,
file,