Add todoist migrator to available migrators in info endpoint if it is enabled

This commit is contained in:
kolaente 2020-05-24 12:51:38 +02:00
parent e89e6d47d4
commit e9bc3246ce
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 1 deletions

View File

@ -18,6 +18,8 @@ package v1
import (
"code.vikunja.io/api/pkg/config"
"code.vikunja.io/api/pkg/modules/migration/todoist"
"code.vikunja.io/api/pkg/modules/migration/wunderlist"
"code.vikunja.io/api/pkg/version"
"github.com/labstack/echo/v4"
"net/http"
@ -51,8 +53,16 @@ func Info(c echo.Context) error {
RegistrationEnabled: config.ServiceEnableRegistration.GetBool(),
TaskAttachmentsEnabled: config.ServiceEnableTaskAttachments.GetBool(),
}
// Migrators
if config.MigrationWunderlistEnable.GetBool() {
infos.AvailableMigrators = append(infos.AvailableMigrators, "wunderlist")
m := &wunderlist.Migration{}
infos.AvailableMigrators = append(infos.AvailableMigrators, m.Name())
}
if config.MigrationTodoistEnable.GetBool() {
m := &todoist.Migration{}
infos.AvailableMigrators = append(infos.AvailableMigrators, m.Name())
}
return c.JSON(http.StatusOK, infos)
}