Add file migrator interface

This commit is contained in:
kolaente 2021-08-30 22:47:01 +02:00
parent aca4a9ef78
commit 92f62a2699
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 13 additions and 1 deletions

View File

@ -17,6 +17,8 @@
package migration
import (
"io"
"code.vikunja.io/api/pkg/user"
)
@ -29,7 +31,17 @@ type Migrator interface {
// The use case for this are Oauth flows, where the server token should remain hidden and not
// known to the frontend.
AuthURL() string
// Title holds the name of the migration.
// Name holds the name of the migration.
// This is used to show the name to users and to keep track of users who already migrated.
Name() string
}
// FileMigrator handles importing Vikunja data from a file. The implementation of it determines the format.
type FileMigrator interface {
// Migrate is the interface used to migrate a user's tasks, list and other things from a file to vikunja.
// The user object is the user who's tasks will be migrated.
Migrate(user *user.User, file io.Reader) error
// Name holds the name of the migration.
// This is used to show the name to users and to keep track of users who already migrated.
Name() string
}