frontend/src/services/migrator/abstractMigration.ts
Dominik Pschenitschni 8b7b4d61a3 feat: MigrateService script setup (#2432)
Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: vikunja/frontend#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>
2022-11-03 14:19:42 +00:00

28 lines
790 B
TypeScript

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<MigrationConfig> {
serviceUrlKey = ''
constructor(serviceUrlKey: string) {
super({
update: '/migration/' + serviceUrlKey + '/migrate',
})
this.serviceUrlKey = serviceUrlKey
}
getAuthUrl() {
return this.getM('/migration/' + this.serviceUrlKey + '/auth')
}
getStatus() {
return this.getM('/migration/' + this.serviceUrlKey + '/status')
}
migrate(data: MigrationConfig) {
return this.update(data)
}
}