Migration #120

Merged
konrad merged 27 commits from feature/migration into master 2020-01-19 16:52:17 +00:00
4 changed files with 269 additions and 1 deletions
Showing only changes of commit 4e8b7d27e1 - Show all commits

View File

@ -331,6 +331,16 @@ func makeAuthGetRequest(token *wunderlistAuthToken, urlPart string, v interface{
}
// Migrate migrates a user's wunderlist lists, tasks, etc.
// @Summary Migrate all lists, tasks etc. from wunderlist
// @Description Migrates all folders, lists, tasks, notes, reminders, subtasks and files from wunderlist to vikunja.
// @tags migration
// @Accept json
// @Produce json
// @Security JWTKeyAuth
// @Param migrationCode body wunderlist.Migration true "The auth code previously obtained from the auth url. See the docs for /migration/wunderlist/auth."
// @Success 200 {object} models.Message "A message telling you everything was migrated successfully."
// @Failure 500 {object} models.Message "Internal server error"
// @Router /migration/wunderlist/migrate [post]
func (w *Migration) Migrate(user *models.User) (err error) {
log.Debugf("[Wunderlist migration] Starting wunderlist migration for user %d", user.ID)
@ -455,6 +465,14 @@ func (w *Migration) Migrate(user *models.User) (err error) {
}
// AuthURL returns the url users need to authenticate against
// @Summary Get the auth url from wunderlist
// @Description Returns the auth url where the user needs to get its auth code. This code can then be used to migrate everything from wunderlist to Vikunja.
// @tags migration
// @Produce json
// @Security JWTKeyAuth
// @Success 200 {object} handler.AuthURL "The auth url."
// @Failure 500 {object} models.Message "Internal server error"
// @Router /migration/wunderlist/auth [get]
func (w *Migration) AuthURL() string {
return "https://www.wunderlist.com/oauth/authorize?client_id=" +
config.MigrationWunderlistClientID.GetString() +

View File

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-12-07 22:54:02.661375666 +0100 CET m=+0.164990732
// 2020-01-19 16:18:04.294790395 +0100 CET m=+0.176548843
package swagger
@ -1615,6 +1615,83 @@ var doc = `{
}
}
},
"/migration/wunderlist/auth": {
"get": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Returns the auth url where the user needs to get its auth code. This code can then be used to migrate everything from wunderlist to Vikunja.",
"produces": [
"application/json"
],
"tags": [
"migration"
],
"summary": "Get the auth url from wunderlist",
"responses": {
"200": {
"description": "The auth url.",
"schema": {
"$ref": "#/definitions/handler.AuthURL"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/migration/wunderlist/migrate": {
"post": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Migrates all folders, lists, tasks, notes, reminders, subtasks and files from wunderlist to vikunja.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"migration"
],
"summary": "Migrate all lists, tasks etc. from wunderlist",
"parameters": [
{
"description": "The auth code previously obtained from the auth url. See the docs for /migration/wunderlist/auth.",
"name": "migrationCode",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/wunderlist.Migration"
}
}
],
"responses": {
"200": {
"description": "A message telling you everything was migrated successfully.",
"schema": {
"$ref": "#/definitions/models.Message"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/namespace/{id}": {
"post": {
"security": [
@ -4463,6 +4540,14 @@ var doc = `{
}
}
},
"handler.AuthURL": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
},
"models.APIUserPassword": {
"type": "object",
"properties": {
@ -5527,6 +5612,15 @@ var doc = `{
"type": "string"
}
}
},
"wunderlist.Migration": {
"type": "object",
"properties": {
"code": {
"description": "Code is the code used to get a user api token",
"type": "string"
}
}
}
},
"securityDefinitions": {

View File

@ -1597,6 +1597,83 @@
}
}
},
"/migration/wunderlist/auth": {
"get": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Returns the auth url where the user needs to get its auth code. This code can then be used to migrate everything from wunderlist to Vikunja.",
"produces": [
"application/json"
],
"tags": [
"migration"
],
"summary": "Get the auth url from wunderlist",
"responses": {
"200": {
"description": "The auth url.",
"schema": {
"$ref": "#/definitions/handler.AuthURL"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/migration/wunderlist/migrate": {
"post": {
"security": [
{
"JWTKeyAuth": []
}
],
"description": "Migrates all folders, lists, tasks, notes, reminders, subtasks and files from wunderlist to vikunja.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"migration"
],
"summary": "Migrate all lists, tasks etc. from wunderlist",
"parameters": [
{
"description": "The auth code previously obtained from the auth url. See the docs for /migration/wunderlist/auth.",
"name": "migrationCode",
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/wunderlist.Migration"
}
}
],
"responses": {
"200": {
"description": "A message telling you everything was migrated successfully.",
"schema": {
"$ref": "#/definitions/models.Message"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/models.Message"
}
}
}
}
},
"/namespace/{id}": {
"post": {
"security": [
@ -4444,6 +4521,14 @@
}
}
},
"handler.AuthURL": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
},
"models.APIUserPassword": {
"type": "object",
"properties": {
@ -5508,6 +5593,15 @@
"type": "string"
}
}
},
"wunderlist.Migration": {
"type": "object",
"properties": {
"code": {
"description": "Code is the code used to get a user api token",
"type": "string"
}
}
}
},
"securityDefinitions": {

View File

@ -13,6 +13,11 @@ definitions:
size:
type: integer
type: object
handler.AuthURL:
properties:
url:
type: string
type: object
models.APIUserPassword:
properties:
email:
@ -860,6 +865,12 @@ definitions:
version:
type: string
type: object
wunderlist.Migration:
properties:
code:
description: Code is the code used to get a user api token
type: string
type: object
info:
contact:
email: hello@vikunja.io
@ -1935,6 +1946,57 @@ paths:
summary: Login
tags:
- user
/migration/wunderlist/auth:
get:
description: Returns the auth url where the user needs to get its auth code.
This code can then be used to migrate everything from wunderlist to Vikunja.
produces:
- application/json
responses:
"200":
description: The auth url.
schema:
$ref: '#/definitions/handler.AuthURL'
"500":
description: Internal server error
schema:
$ref: '#/definitions/models.Message'
security:
- JWTKeyAuth: []
summary: Get the auth url from wunderlist
tags:
- migration
/migration/wunderlist/migrate:
post:
consumes:
- application/json
description: Migrates all folders, lists, tasks, notes, reminders, subtasks
and files from wunderlist to vikunja.
parameters:
- description: The auth code previously obtained from the auth url. See the
docs for /migration/wunderlist/auth.
in: body
name: migrationCode
required: true
schema:
$ref: '#/definitions/wunderlist.Migration'
type: object
produces:
- application/json
responses:
"200":
description: A message telling you everything was migrated successfully.
schema:
$ref: '#/definitions/models.Message'
"500":
description: Internal server error
schema:
$ref: '#/definitions/models.Message'
security:
- JWTKeyAuth: []
summary: Migrate all lists, tasks etc. from wunderlist
tags:
- migration
/namespace/{id}:
post:
consumes: