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
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -18,6 +18,8 @@ package v1
import ( import (
"code.vikunja.io/api/pkg/config" "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" "code.vikunja.io/api/pkg/version"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"net/http" "net/http"
@ -51,8 +53,16 @@ func Info(c echo.Context) error {
RegistrationEnabled: config.ServiceEnableRegistration.GetBool(), RegistrationEnabled: config.ServiceEnableRegistration.GetBool(),
TaskAttachmentsEnabled: config.ServiceEnableTaskAttachments.GetBool(), TaskAttachmentsEnabled: config.ServiceEnableTaskAttachments.GetBool(),
} }
// Migrators
if config.MigrationWunderlistEnable.GetBool() { 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) return c.JSON(http.StatusOK, infos)
} }