diff --git a/pkg/modules/migration/migration_status.go b/pkg/modules/migration/migration_status.go index cfce103b7..4ec8bec88 100644 --- a/pkg/modules/migration/migration_status.go +++ b/pkg/modules/migration/migration_status.go @@ -21,9 +21,9 @@ import "code.vikunja.io/api/pkg/models" // Status represents this migration status type Status struct { ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` - UserID int64 `xorm:"int(11) not null" json:"user_id"` + UserID int64 `xorm:"int(11) not null" json:"-"` MigratorName string `xorm:"varchar(255)" json:"migrator_name"` - CreatedUnix int64 `xorm:"created not null"` + CreatedUnix int64 `xorm:"created not null" json:"time_unix"` } // TableName holds the table name for the migration status table diff --git a/pkg/modules/migration/wunderlist/wunderlist.go b/pkg/modules/migration/wunderlist/wunderlist.go index 255753f34..3930146b2 100644 --- a/pkg/modules/migration/wunderlist/wunderlist.go +++ b/pkg/modules/migration/wunderlist/wunderlist.go @@ -482,6 +482,14 @@ func (w *Migration) AuthURL() string { } // Name is used to get the name of the wunderlist migration +// @Summary Get migration status +// @Description Returns if the current user already did the migation or not. This is useful to show a confirmation message in the frontend if the user is trying to do the same migration again. +// @tags migration +// @Produce json +// @Security JWTKeyAuth +// @Success 200 {object} migration.Status "The migration status" +// @Failure 500 {object} models.Message "Internal server error" +// @Router /migration/wunderlist/status [get] func (w *Migration) Name() string { return "wunderlist" } diff --git a/pkg/swagger/docs.go b/pkg/swagger/docs.go index 5b10b2ed6..b7dc4f959 100644 --- a/pkg/swagger/docs.go +++ b/pkg/swagger/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2020-01-19 16:18:04.294790395 +0100 CET m=+0.176548843 +// 2020-01-20 20:27:54.414478978 +0100 CET m=+0.171577588 package swagger @@ -1692,6 +1692,37 @@ var doc = `{ } } }, + "/migration/wunderlist/status": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Returns if the current user already did the migation or not. This is useful to show a confirmation message in the frontend if the user is trying to do the same migration again.", + "produces": [ + "application/json" + ], + "tags": [ + "migration" + ], + "summary": "Get migration status", + "responses": { + "200": { + "description": "The migration status", + "schema": { + "$ref": "#/definitions/migration.Status" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/namespace/{id}": { "post": { "security": [ @@ -4548,6 +4579,20 @@ var doc = `{ } } }, + "migration.Status": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "migrator_name": { + "type": "string" + }, + "time_unix": { + "type": "integer" + } + } + }, "models.APIUserPassword": { "type": "object", "properties": { @@ -5596,6 +5641,12 @@ var doc = `{ "v1.vikunjaInfos": { "type": "object", "properties": { + "available_migrators": { + "type": "array", + "items": { + "type": "string" + } + }, "frontend_url": { "type": "string" }, @@ -5608,6 +5659,9 @@ var doc = `{ "motd": { "type": "string" }, + "registration_enabled": { + "type": "boolean" + }, "version": { "type": "string" } diff --git a/pkg/swagger/swagger.json b/pkg/swagger/swagger.json index 49d341ef9..295522af8 100644 --- a/pkg/swagger/swagger.json +++ b/pkg/swagger/swagger.json @@ -1674,6 +1674,37 @@ } } }, + "/migration/wunderlist/status": { + "get": { + "security": [ + { + "JWTKeyAuth": [] + } + ], + "description": "Returns if the current user already did the migation or not. This is useful to show a confirmation message in the frontend if the user is trying to do the same migration again.", + "produces": [ + "application/json" + ], + "tags": [ + "migration" + ], + "summary": "Get migration status", + "responses": { + "200": { + "description": "The migration status", + "schema": { + "$ref": "#/definitions/migration.Status" + } + }, + "500": { + "description": "Internal server error", + "schema": { + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/namespace/{id}": { "post": { "security": [ @@ -4529,6 +4560,20 @@ } } }, + "migration.Status": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "migrator_name": { + "type": "string" + }, + "time_unix": { + "type": "integer" + } + } + }, "models.APIUserPassword": { "type": "object", "properties": { @@ -5577,6 +5622,12 @@ "v1.vikunjaInfos": { "type": "object", "properties": { + "available_migrators": { + "type": "array", + "items": { + "type": "string" + } + }, "frontend_url": { "type": "string" }, @@ -5589,6 +5640,9 @@ "motd": { "type": "string" }, + "registration_enabled": { + "type": "boolean" + }, "version": { "type": "string" } diff --git a/pkg/swagger/swagger.yaml b/pkg/swagger/swagger.yaml index 6f59419c7..5e0206d3f 100644 --- a/pkg/swagger/swagger.yaml +++ b/pkg/swagger/swagger.yaml @@ -18,6 +18,15 @@ definitions: url: type: string type: object + migration.Status: + properties: + id: + type: integer + migrator_name: + type: string + time_unix: + type: integer + type: object models.APIUserPassword: properties: email: @@ -854,6 +863,10 @@ definitions: type: object v1.vikunjaInfos: properties: + available_migrators: + items: + type: string + type: array frontend_url: type: string link_sharing_enabled: @@ -862,6 +875,8 @@ definitions: type: string motd: type: string + registration_enabled: + type: boolean version: type: string type: object @@ -1997,6 +2012,27 @@ paths: summary: Migrate all lists, tasks etc. from wunderlist tags: - migration + /migration/wunderlist/status: + get: + description: Returns if the current user already did the migation or not. This + is useful to show a confirmation message in the frontend if the user is trying + to do the same migration again. + produces: + - application/json + responses: + "200": + description: The migration status + schema: + $ref: '#/definitions/migration.Status' + "500": + description: Internal server error + schema: + $ref: '#/definitions/models.Message' + security: + - JWTKeyAuth: [] + summary: Get migration status + tags: + - migration /namespace/{id}: post: consumes: