2021-11-27 07:37:06 +00:00
|
|
|
import { BaseAPI } from "../_base";
|
|
|
|
import { ReportSummary } from "./group-reports";
|
|
|
|
|
|
|
|
const prefix = "/api";
|
|
|
|
|
2021-12-10 04:52:53 +00:00
|
|
|
export type SupportedMigration = "nextcloud" | "chowdown" | "mealie_alpha" | "paprika";
|
2021-11-27 07:37:06 +00:00
|
|
|
|
|
|
|
export interface MigrationPayload {
|
2021-12-10 04:52:53 +00:00
|
|
|
addMigrationTag: boolean;
|
2021-11-27 07:37:06 +00:00
|
|
|
migrationType: SupportedMigration;
|
|
|
|
archive: File;
|
|
|
|
}
|
|
|
|
|
|
|
|
const routes = {
|
|
|
|
base: `${prefix}/groups/migrations`,
|
|
|
|
};
|
|
|
|
|
|
|
|
export class GroupMigrationApi extends BaseAPI {
|
|
|
|
async startMigration(payload: MigrationPayload) {
|
|
|
|
const form = new FormData();
|
2021-12-10 04:52:53 +00:00
|
|
|
form.append("add_migration_tag", String(payload.addMigrationTag));
|
2021-11-27 07:37:06 +00:00
|
|
|
form.append("migration_type", payload.migrationType);
|
|
|
|
form.append("archive", payload.archive);
|
|
|
|
|
|
|
|
console.log(form);
|
|
|
|
|
|
|
|
return await this.requests.post<ReportSummary>(routes.base, form);
|
|
|
|
}
|
|
|
|
}
|