Refactor {List|Namespace}{User|Team} to not expose unneded values via json (#52)

This commit is contained in:
konrad 2019-01-14 22:32:56 +00:00 committed by Gitea
parent cf0b0a2853
commit 19218b28a2
12 changed files with 87 additions and 164 deletions

View file

@ -154,7 +154,7 @@ Sorry for some of them being in German, I'll tranlate them at some point.
### Refactor ### Refactor
* [x] ListTaskRights, sollte überall gleich funktionieren, gibt ja mittlerweile auch eine Methode um liste von nem Task aus zu kriegen oder so * [x] ListTaskRights, sollte überall gleich funktionieren, gibt ja mittlerweile auch eine Methode um liste von nem Task aus zu kriegen oder so
* [ ] Re-check all `{List|Namespace}{User|Team}` if really all parameters need to be exposed via json or are overwritten via param anyway. * [x] Re-check all `{List|Namespace}{User|Team}` if really all parameters need to be exposed via json or are overwritten via param anyway.
### Vikunja web ### Vikunja web

View file

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at // This file was generated by swaggo/swag at
// 2019-01-10 00:01:27.123040428 +0100 CET m=+0.110268080 // 2019-01-14 23:02:47.994258682 +0100 CET m=+0.170768570
package docs package docs
@ -14,7 +14,7 @@ import (
var doc = `{ var doc = `{
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer \u003cjwt-token\u003e` + "`" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e", "description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API", "title": "Vikunja API",
"contact": { "contact": {
"name": "General Vikunja contact", "name": "General Vikunja contact",
@ -37,7 +37,7 @@ var doc = `{
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.", "description": "Returns an array with all assignees for this task.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -45,9 +45,9 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"labels" "assignees"
], ],
"summary": "Get all labels a user has access to", "summary": "Get all assignees for a task",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -57,18 +57,18 @@ var doc = `{
}, },
{ {
"type": "string", "type": "string",
"description": "Search labels by label text.", "description": "Search assignees by their username.",
"name": "s", "name": "s",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The labels", "description": "The assignees",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.User"
} }
} }
}, },
@ -3799,6 +3799,7 @@ var doc = `{
"maxLength": 250 "maxLength": 250
}, },
"done": { "done": {
"description": "Whether a task is done or not.",
"type": "boolean" "type": "boolean"
}, },
"dueDate": { "dueDate": {
@ -3820,10 +3821,6 @@ var doc = `{
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.Label"
} }
}, },
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": { "parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.", "description": "If the task is a subtask, this is the id of its parent.",
"type": "integer" "type": "integer"
@ -3997,6 +3994,7 @@ var doc = `{
"maxLength": 250 "maxLength": 250
}, },
"done": { "done": {
"description": "Whether a task is done or not.",
"type": "boolean" "type": "boolean"
}, },
"dueDate": { "dueDate": {
@ -4018,10 +4016,6 @@ var doc = `{
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.Label"
} }
}, },
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": { "parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.", "description": "If the task is a subtask, this is the id of its parent.",
"type": "integer" "type": "integer"
@ -4086,10 +4080,6 @@ var doc = `{
"description": "The unique, numeric id of this list \u003c-\u003e user relation.", "description": "The unique, numeric id of this list \u003c-\u003e user relation.",
"type": "integer" "type": "integer"
}, },
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": { "right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
@ -4100,7 +4090,7 @@ var doc = `{
"description": "A unix timestamp when this relation was last updated. You cannot change this value.", "description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"user_id": { "userID": {
"description": "The user id.", "description": "The user id.",
"type": "integer" "type": "integer"
} }
@ -4159,10 +4149,6 @@ var doc = `{
"description": "The unique, numeric id of this namespace \u003c-\u003e user relation.", "description": "The unique, numeric id of this namespace \u003c-\u003e user relation.",
"type": "integer" "type": "integer"
}, },
"namespace_id": {
"description": "The namespace id",
"type": "integer"
},
"right": { "right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
@ -4173,7 +4159,7 @@ var doc = `{
"description": "A unix timestamp when this relation was last updated. You cannot change this value.", "description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"user_id": { "userID": {
"description": "The user id.", "description": "The user id.",
"type": "integer" "type": "integer"
} }
@ -4247,7 +4233,7 @@ var doc = `{
"description": "A unix timestamp when this relation was created. You cannot change this value.", "description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"created_by": { "createdBy": {
"description": "The user who created this team.", "description": "The user who created this team.",
"type": "object", "type": "object",
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.User"
@ -4292,17 +4278,13 @@ var doc = `{
"description": "The unique, numeric id of this list \u003c-\u003e team relation.", "description": "The unique, numeric id of this list \u003c-\u003e team relation.",
"type": "integer" "type": "integer"
}, },
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": { "right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
"default": 0, "default": 0,
"maximum": 2 "maximum": 2
}, },
"team_id": { "teamID": {
"description": "The team id.", "description": "The team id.",
"type": "integer" "type": "integer"
}, },
@ -4327,11 +4309,7 @@ var doc = `{
"description": "The unique, numeric id of this team member relation.", "description": "The unique, numeric id of this team member relation.",
"type": "integer" "type": "integer"
}, },
"team_id": { "userID": {
"description": "The team id.",
"type": "integer"
},
"user_id": {
"description": "The id of the member.", "description": "The id of the member.",
"type": "integer" "type": "integer"
} }
@ -4348,17 +4326,13 @@ var doc = `{
"description": "The unique, numeric id of this namespace \u003c-\u003e team relation.", "description": "The unique, numeric id of this namespace \u003c-\u003e team relation.",
"type": "integer" "type": "integer"
}, },
"namespace_id": {
"description": "The namespace id.",
"type": "integer"
},
"right": { "right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
"default": 0, "default": 0,
"maximum": 2 "maximum": 2
}, },
"team_id": { "teamID": {
"description": "The team id.", "description": "The team id.",
"type": "integer" "type": "integer"
}, },
@ -4380,7 +4354,7 @@ var doc = `{
"type": "integer" "type": "integer"
}, },
"email": { "email": {
"description": "The user's email address", "description": "The user's email address.",
"type": "string", "type": "string",
"maxLength": 250 "maxLength": 250
}, },
@ -4393,7 +4367,7 @@ var doc = `{
"type": "integer" "type": "integer"
}, },
"username": { "username": {
"description": "The username of the username. Is always unique.", "description": "The username of the user. Is always unique.",
"type": "string", "type": "string",
"maxLength": 250, "maxLength": 250,
"minLength": 3 "minLength": 3
@ -4407,7 +4381,7 @@ var doc = `{
"description": "A unix timestamp when this relation was created. You cannot change this value.", "description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"created_by": { "createdBy": {
"description": "The user who created this team.", "description": "The user who created this team.",
"type": "object", "type": "object",
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.User"
@ -4452,7 +4426,7 @@ var doc = `{
"type": "integer" "type": "integer"
}, },
"email": { "email": {
"description": "The user's email address", "description": "The user's email address.",
"type": "string", "type": "string",
"maxLength": 250 "maxLength": 250
}, },
@ -4465,7 +4439,7 @@ var doc = `{
"type": "integer" "type": "integer"
}, },
"username": { "username": {
"description": "The username of the username. Is always unique.", "description": "The username of the user. Is always unique.",
"type": "string", "type": "string",
"maxLength": 250, "maxLength": 250,
"minLength": 3 "minLength": 3
@ -4493,7 +4467,7 @@ var doc = `{
"type": "integer" "type": "integer"
}, },
"email": { "email": {
"description": "The user's email address", "description": "The user's email address.",
"type": "string", "type": "string",
"maxLength": 250 "maxLength": 250
}, },
@ -4509,7 +4483,7 @@ var doc = `{
"type": "integer" "type": "integer"
}, },
"username": { "username": {
"description": "The username of the username. Is always unique.", "description": "The username of the user. Is always unique.",
"type": "string", "type": "string",
"maxLength": 250, "maxLength": 250,
"minLength": 3 "minLength": 3

View file

@ -1,7 +1,7 @@
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. \u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e\n# Authorization\n**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + \"`\" + `Authorization: Bearer \u003cjwt-token\u003e` + \"`\" + `-header to authenticate successfully.\n\n**BasicAuth:** Only used when requesting tasks via caldav.\n\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e", "description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e",
"title": "Vikunja API", "title": "Vikunja API",
"contact": { "contact": {
"name": "General Vikunja contact", "name": "General Vikunja contact",
@ -24,7 +24,7 @@
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.", "description": "Returns an array with all assignees for this task.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -32,9 +32,9 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"labels" "assignees"
], ],
"summary": "Get all labels a user has access to", "summary": "Get all assignees for a task",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -44,18 +44,18 @@
}, },
{ {
"type": "string", "type": "string",
"description": "Search labels by label text.", "description": "Search assignees by their username.",
"name": "s", "name": "s",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The labels", "description": "The assignees",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.User"
} }
} }
}, },
@ -3785,6 +3785,7 @@
"maxLength": 250 "maxLength": 250
}, },
"done": { "done": {
"description": "Whether a task is done or not.",
"type": "boolean" "type": "boolean"
}, },
"dueDate": { "dueDate": {
@ -3806,10 +3807,6 @@
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.Label"
} }
}, },
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": { "parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.", "description": "If the task is a subtask, this is the id of its parent.",
"type": "integer" "type": "integer"
@ -3983,6 +3980,7 @@
"maxLength": 250 "maxLength": 250
}, },
"done": { "done": {
"description": "Whether a task is done or not.",
"type": "boolean" "type": "boolean"
}, },
"dueDate": { "dueDate": {
@ -4004,10 +4002,6 @@
"$ref": "#/definitions/models.Label" "$ref": "#/definitions/models.Label"
} }
}, },
"listID": {
"description": "The list this task belongs to.",
"type": "integer"
},
"parentTaskID": { "parentTaskID": {
"description": "If the task is a subtask, this is the id of its parent.", "description": "If the task is a subtask, this is the id of its parent.",
"type": "integer" "type": "integer"
@ -4072,10 +4066,6 @@
"description": "The unique, numeric id of this list \u003c-\u003e user relation.", "description": "The unique, numeric id of this list \u003c-\u003e user relation.",
"type": "integer" "type": "integer"
}, },
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": { "right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
@ -4086,7 +4076,7 @@
"description": "A unix timestamp when this relation was last updated. You cannot change this value.", "description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"user_id": { "userID": {
"description": "The user id.", "description": "The user id.",
"type": "integer" "type": "integer"
} }
@ -4145,10 +4135,6 @@
"description": "The unique, numeric id of this namespace \u003c-\u003e user relation.", "description": "The unique, numeric id of this namespace \u003c-\u003e user relation.",
"type": "integer" "type": "integer"
}, },
"namespace_id": {
"description": "The namespace id",
"type": "integer"
},
"right": { "right": {
"description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this user has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
@ -4159,7 +4145,7 @@
"description": "A unix timestamp when this relation was last updated. You cannot change this value.", "description": "A unix timestamp when this relation was last updated. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"user_id": { "userID": {
"description": "The user id.", "description": "The user id.",
"type": "integer" "type": "integer"
} }
@ -4233,7 +4219,7 @@
"description": "A unix timestamp when this relation was created. You cannot change this value.", "description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"created_by": { "createdBy": {
"description": "The user who created this team.", "description": "The user who created this team.",
"type": "object", "type": "object",
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.User"
@ -4278,17 +4264,13 @@
"description": "The unique, numeric id of this list \u003c-\u003e team relation.", "description": "The unique, numeric id of this list \u003c-\u003e team relation.",
"type": "integer" "type": "integer"
}, },
"list_id": {
"description": "The list id.",
"type": "integer"
},
"right": { "right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
"default": 0, "default": 0,
"maximum": 2 "maximum": 2
}, },
"team_id": { "teamID": {
"description": "The team id.", "description": "The team id.",
"type": "integer" "type": "integer"
}, },
@ -4313,11 +4295,7 @@
"description": "The unique, numeric id of this team member relation.", "description": "The unique, numeric id of this team member relation.",
"type": "integer" "type": "integer"
}, },
"team_id": { "userID": {
"description": "The team id.",
"type": "integer"
},
"user_id": {
"description": "The id of the member.", "description": "The id of the member.",
"type": "integer" "type": "integer"
} }
@ -4334,17 +4312,13 @@
"description": "The unique, numeric id of this namespace \u003c-\u003e team relation.", "description": "The unique, numeric id of this namespace \u003c-\u003e team relation.",
"type": "integer" "type": "integer"
}, },
"namespace_id": {
"description": "The namespace id.",
"type": "integer"
},
"right": { "right": {
"description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.", "description": "The right this team has. 0 = Read only, 1 = Read \u0026 Write, 2 = Admin. See the docs for more details.",
"type": "integer", "type": "integer",
"default": 0, "default": 0,
"maximum": 2 "maximum": 2
}, },
"team_id": { "teamID": {
"description": "The team id.", "description": "The team id.",
"type": "integer" "type": "integer"
}, },
@ -4366,7 +4340,7 @@
"type": "integer" "type": "integer"
}, },
"email": { "email": {
"description": "The user's email address", "description": "The user's email address.",
"type": "string", "type": "string",
"maxLength": 250 "maxLength": 250
}, },
@ -4379,7 +4353,7 @@
"type": "integer" "type": "integer"
}, },
"username": { "username": {
"description": "The username of the username. Is always unique.", "description": "The username of the user. Is always unique.",
"type": "string", "type": "string",
"maxLength": 250, "maxLength": 250,
"minLength": 3 "minLength": 3
@ -4393,7 +4367,7 @@
"description": "A unix timestamp when this relation was created. You cannot change this value.", "description": "A unix timestamp when this relation was created. You cannot change this value.",
"type": "integer" "type": "integer"
}, },
"created_by": { "createdBy": {
"description": "The user who created this team.", "description": "The user who created this team.",
"type": "object", "type": "object",
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.User"
@ -4438,7 +4412,7 @@
"type": "integer" "type": "integer"
}, },
"email": { "email": {
"description": "The user's email address", "description": "The user's email address.",
"type": "string", "type": "string",
"maxLength": 250 "maxLength": 250
}, },
@ -4451,7 +4425,7 @@
"type": "integer" "type": "integer"
}, },
"username": { "username": {
"description": "The username of the username. Is always unique.", "description": "The username of the user. Is always unique.",
"type": "string", "type": "string",
"maxLength": 250, "maxLength": 250,
"minLength": 3 "minLength": 3
@ -4479,7 +4453,7 @@
"type": "integer" "type": "integer"
}, },
"email": { "email": {
"description": "The user's email address", "description": "The user's email address.",
"type": "string", "type": "string",
"maxLength": 250 "maxLength": 250
}, },
@ -4495,7 +4469,7 @@
"type": "integer" "type": "integer"
}, },
"username": { "username": {
"description": "The username of the username. Is always unique.", "description": "The username of the user. Is always unique.",
"type": "string", "type": "string",
"maxLength": 250, "maxLength": 250,
"minLength": 3 "minLength": 3

View file

@ -49,6 +49,7 @@ definitions:
maxLength: 250 maxLength: 250
type: string type: string
done: done:
description: Whether a task is done or not.
type: boolean type: boolean
dueDate: dueDate:
description: A unix timestamp when the task is due. description: A unix timestamp when the task is due.
@ -64,9 +65,6 @@ definitions:
items: items:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.Label'
type: array type: array
listID:
description: The list this task belongs to.
type: integer
parentTaskID: parentTaskID:
description: If the task is a subtask, this is the id of its parent. description: If the task is a subtask, this is the id of its parent.
type: integer type: integer
@ -207,6 +205,7 @@ definitions:
maxLength: 250 maxLength: 250
type: string type: string
done: done:
description: Whether a task is done or not.
type: boolean type: boolean
dueDate: dueDate:
description: A unix timestamp when the task is due. description: A unix timestamp when the task is due.
@ -222,9 +221,6 @@ definitions:
items: items:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.Label'
type: array type: array
listID:
description: The list this task belongs to.
type: integer
parentTaskID: parentTaskID:
description: If the task is a subtask, this is the id of its parent. description: If the task is a subtask, this is the id of its parent.
type: integer type: integer
@ -277,9 +273,6 @@ definitions:
id: id:
description: The unique, numeric id of this list <-> user relation. description: The unique, numeric id of this list <-> user relation.
type: integer type: integer
list_id:
description: The list id.
type: integer
right: right:
default: 0 default: 0
description: The right this user has. 0 = Read only, 1 = Read & Write, 2 = description: The right this user has. 0 = Read only, 1 = Read & Write, 2 =
@ -290,7 +283,7 @@ definitions:
description: A unix timestamp when this relation was last updated. You cannot description: A unix timestamp when this relation was last updated. You cannot
change this value. change this value.
type: integer type: integer
user_id: userID:
description: The user id. description: The user id.
type: integer type: integer
type: object type: object
@ -336,9 +329,6 @@ definitions:
id: id:
description: The unique, numeric id of this namespace <-> user relation. description: The unique, numeric id of this namespace <-> user relation.
type: integer type: integer
namespace_id:
description: The namespace id
type: integer
right: right:
default: 0 default: 0
description: The right this user has. 0 = Read only, 1 = Read & Write, 2 = description: The right this user has. 0 = Read only, 1 = Read & Write, 2 =
@ -349,7 +339,7 @@ definitions:
description: A unix timestamp when this relation was last updated. You cannot description: A unix timestamp when this relation was last updated. You cannot
change this value. change this value.
type: integer type: integer
user_id: userID:
description: The user id. description: The user id.
type: integer type: integer
type: object type: object
@ -405,7 +395,7 @@ definitions:
description: A unix timestamp when this relation was created. You cannot change description: A unix timestamp when this relation was created. You cannot change
this value. this value.
type: integer type: integer
created_by: createdBy:
$ref: '#/definitions/models.User' $ref: '#/definitions/models.User'
description: The user who created this team. description: The user who created this team.
type: object type: object
@ -441,16 +431,13 @@ definitions:
id: id:
description: The unique, numeric id of this list <-> team relation. description: The unique, numeric id of this list <-> team relation.
type: integer type: integer
list_id:
description: The list id.
type: integer
right: right:
default: 0 default: 0
description: The right this team has. 0 = Read only, 1 = Read & Write, 2 = description: The right this team has. 0 = Read only, 1 = Read & Write, 2 =
Admin. See the docs for more details. Admin. See the docs for more details.
maximum: 2 maximum: 2
type: integer type: integer
team_id: teamID:
description: The team id. description: The team id.
type: integer type: integer
updated: updated:
@ -471,10 +458,7 @@ definitions:
id: id:
description: The unique, numeric id of this team member relation. description: The unique, numeric id of this team member relation.
type: integer type: integer
team_id: userID:
description: The team id.
type: integer
user_id:
description: The id of the member. description: The id of the member.
type: integer type: integer
type: object type: object
@ -487,16 +471,13 @@ definitions:
id: id:
description: The unique, numeric id of this namespace <-> team relation. description: The unique, numeric id of this namespace <-> team relation.
type: integer type: integer
namespace_id:
description: The namespace id.
type: integer
right: right:
default: 0 default: 0
description: The right this team has. 0 = Read only, 1 = Read & Write, 2 = description: The right this team has. 0 = Read only, 1 = Read & Write, 2 =
Admin. See the docs for more details. Admin. See the docs for more details.
maximum: 2 maximum: 2
type: integer type: integer
team_id: teamID:
description: The team id. description: The team id.
type: integer type: integer
updated: updated:
@ -515,7 +496,7 @@ definitions:
this value. this value.
type: integer type: integer
email: email:
description: The user's email address description: The user's email address.
maxLength: 250 maxLength: 250
type: string type: string
id: id:
@ -526,7 +507,7 @@ definitions:
change this value. change this value.
type: integer type: integer
username: username:
description: The username of the username. Is always unique. description: The username of the user. Is always unique.
maxLength: 250 maxLength: 250
minLength: 3 minLength: 3
type: string type: string
@ -537,7 +518,7 @@ definitions:
description: A unix timestamp when this relation was created. You cannot change description: A unix timestamp when this relation was created. You cannot change
this value. this value.
type: integer type: integer
created_by: createdBy:
$ref: '#/definitions/models.User' $ref: '#/definitions/models.User'
description: The user who created this team. description: The user who created this team.
type: object type: object
@ -573,7 +554,7 @@ definitions:
this value. this value.
type: integer type: integer
email: email:
description: The user's email address description: The user's email address.
maxLength: 250 maxLength: 250
type: string type: string
id: id:
@ -584,7 +565,7 @@ definitions:
change this value. change this value.
type: integer type: integer
username: username:
description: The username of the username. Is always unique. description: The username of the user. Is always unique.
maxLength: 250 maxLength: 250
minLength: 3 minLength: 3
type: string type: string
@ -605,7 +586,7 @@ definitions:
this value. this value.
type: integer type: integer
email: email:
description: The user's email address description: The user's email address.
maxLength: 250 maxLength: 250
type: string type: string
id: id:
@ -618,7 +599,7 @@ definitions:
change this value. change this value.
type: integer type: integer
username: username:
description: The username of the username. Is always unique. description: The username of the user. Is always unique.
maxLength: 250 maxLength: 250
minLength: 3 minLength: 3
type: string type: string
@ -641,13 +622,7 @@ info:
email: hello@vikunja.io email: hello@vikunja.io
name: General Vikunja contact name: General Vikunja contact
url: http://vikunja.io/en/contact/ url: http://vikunja.io/en/contact/
description: |- description: '<!-- ReDoc-Inject: <security-definitions> -->'
This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. <!-- ReDoc-Inject: <security-definitions> -->
# Authorization
**JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer <jwt-token>` + "`" + `-header to authenticate successfully.
**BasicAuth:** Only used when requesting tasks via caldav.
<!-- ReDoc-Inject: <security-definitions> -->
license: license:
name: GPLv3 name: GPLv3
url: http://code.vikunja.io/api/src/branch/master/LICENSE url: http://code.vikunja.io/api/src/branch/master/LICENSE
@ -658,15 +633,14 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: Returns all labels which are either created by the user or associated description: Returns an array with all assignees for this task.
with a task the user has at least read-access to.
parameters: parameters:
- description: The page number. Used for pagination. If not provided, the first - description: The page number. Used for pagination. If not provided, the first
page of results is returned. page of results is returned.
in: query in: query
name: p name: p
type: integer type: integer
- description: Search labels by label text. - description: Search assignees by their username.
in: query in: query
name: s name: s
type: string type: string
@ -674,10 +648,10 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: The labels description: The assignees
schema: schema:
items: items:
$ref: '#/definitions/models.Label' $ref: '#/definitions/models.User'
type: array type: array
"500": "500":
description: Internal error description: Internal error
@ -686,9 +660,9 @@ paths:
type: object type: object
security: security:
- JWTKeyAuth: [] - JWTKeyAuth: []
summary: Get all labels a user has access to summary: Get all assignees for a task
tags: tags:
- labels - assignees
put: put:
consumes: consumes:
- application/json - application/json

View file

@ -24,7 +24,7 @@ import (
// LabelTask represents a relation between a label and a task // LabelTask represents a relation between a label and a task
type LabelTask struct { type LabelTask struct {
// The unique, numeric id of this label. // The unique, numeric id of this label.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"-"`
TaskID int64 `xorm:"int(11) INDEX not null" json:"-" param:"listtask"` TaskID int64 `xorm:"int(11) INDEX not null" json:"-" param:"listtask"`
// The label id you want to associate with a task. // The label id you want to associate with a task.
LabelID int64 `xorm:"int(11) INDEX not null" json:"label_id" param:"label"` LabelID int64 `xorm:"int(11) INDEX not null" json:"label_id" param:"label"`

View file

@ -29,6 +29,7 @@ type ListTask struct {
Text string `xorm:"varchar(250)" json:"text" valid:"runelength(3|250)" minLength:"3" maxLength:"250"` Text string `xorm:"varchar(250)" json:"text" valid:"runelength(3|250)" minLength:"3" maxLength:"250"`
// The task description. // The task description.
Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)" maxLength:"250"` Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)" maxLength:"250"`
// Whether a task is done or not.
Done bool `xorm:"INDEX" json:"done"` Done bool `xorm:"INDEX" json:"done"`
// A unix timestamp when the task is due. // A unix timestamp when the task is due.
DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"` DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"`
@ -36,7 +37,7 @@ type ListTask struct {
RemindersUnix []int64 `xorm:"JSON TEXT" json:"reminderDates"` RemindersUnix []int64 `xorm:"JSON TEXT" json:"reminderDates"`
CreatedByID int64 `xorm:"int(11)" json:"-"` // ID of the user who put that task on the list CreatedByID int64 `xorm:"int(11)" json:"-"` // ID of the user who put that task on the list
// The list this task belongs to. // The list this task belongs to.
ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"` ListID int64 `xorm:"int(11) INDEX" json:"-" param:"list"`
// An amount in seconds this task repeats itself. If this is set, when marking the task as done, it will mark itself as "undone" and then increase all remindes and the due date by its amount. // An amount in seconds this task repeats itself. If this is set, when marking the task as done, it will mark itself as "undone" and then increase all remindes and the due date by its amount.
RepeatAfter int64 `xorm:"int(11) INDEX" json:"repeatAfter"` RepeatAfter int64 `xorm:"int(11) INDEX" json:"repeatAfter"`
// If the task is a subtask, this is the id of its parent. // If the task is a subtask, this is the id of its parent.

View file

@ -23,9 +23,9 @@ type ListUser struct {
// The unique, numeric id of this list <-> user relation. // The unique, numeric id of this list <-> user relation.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"`
// The user id. // The user id.
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"` UserID int64 `xorm:"int(11) not null INDEX" json:"userID" param:"user"`
// The list id. // The list id.
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"` ListID int64 `xorm:"int(11) not null INDEX" json:"-" param:"list"`
// The right this user has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details. // The right this user has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"` Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -23,9 +23,9 @@ type NamespaceUser struct {
// The unique, numeric id of this namespace <-> user relation. // The unique, numeric id of this namespace <-> user relation.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"namespace"`
// The user id. // The user id.
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"` UserID int64 `xorm:"int(11) not null INDEX" json:"userID" param:"user"`
// The namespace id // The namespace id
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"` NamespaceID int64 `xorm:"int(11) not null INDEX" json:"-" param:"namespace"`
// The right this user has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details. // The right this user has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"` Right UserRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -23,9 +23,9 @@ type TeamList struct {
// The unique, numeric id of this list <-> team relation. // The unique, numeric id of this list <-> team relation.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
// The team id. // The team id.
TeamID int64 `xorm:"int(11) not null INDEX" json:"team_id" param:"team"` TeamID int64 `xorm:"int(11) not null INDEX" json:"teamID" param:"team"`
// The list id. // The list id.
ListID int64 `xorm:"int(11) not null INDEX" json:"list_id" param:"list"` ListID int64 `xorm:"int(11) not null INDEX" json:"-" param:"list"`
// The right this team has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details. // The right this team has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"` Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -23,9 +23,9 @@ type TeamNamespace struct {
// The unique, numeric id of this namespace <-> team relation. // The unique, numeric id of this namespace <-> team relation.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
// The team id. // The team id.
TeamID int64 `xorm:"int(11) not null INDEX" json:"team_id" param:"team"` TeamID int64 `xorm:"int(11) not null INDEX" json:"teamID" param:"team"`
// The namespace id. // The namespace id.
NamespaceID int64 `xorm:"int(11) not null INDEX" json:"namespace_id" param:"namespace"` NamespaceID int64 `xorm:"int(11) not null INDEX" json:"-" param:"namespace"`
// The right this team has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details. // The right this team has. 0 = Read only, 1 = Read & Write, 2 = Admin. See the docs for more details.
Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"` Right TeamRight `xorm:"int(11) INDEX" json:"right" valid:"length(0|2)" maximum:"2" default:"0"`

View file

@ -29,7 +29,7 @@ type Team struct {
CreatedByID int64 `xorm:"int(11) not null INDEX" json:"-"` CreatedByID int64 `xorm:"int(11) not null INDEX" json:"-"`
// The user who created this team. // The user who created this team.
CreatedBy User `xorm:"-" json:"created_by"` CreatedBy User `xorm:"-" json:"createdBy"`
// An array of all members in this team. // An array of all members in this team.
Members []*TeamUser `xorm:"-" json:"members"` Members []*TeamUser `xorm:"-" json:"members"`
@ -65,9 +65,9 @@ type TeamMember struct {
// The unique, numeric id of this team member relation. // The unique, numeric id of this team member relation.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
// The team id. // The team id.
TeamID int64 `xorm:"int(11) not null INDEX" json:"team_id" param:"team"` TeamID int64 `xorm:"int(11) not null INDEX" json:"-" param:"team"`
// The id of the member. // The id of the member.
UserID int64 `xorm:"int(11) not null INDEX" json:"user_id" param:"user"` UserID int64 `xorm:"int(11) not null INDEX" json:"userID" param:"user"`
// Whether or not the member is an admin of the team. See the docs for more about what a team admin can do // Whether or not the member is an admin of the team. See the docs for more about what a team admin can do
Admin bool `xorm:"tinyint(1) INDEX" json:"admin"` Admin bool `xorm:"tinyint(1) INDEX" json:"admin"`

View file

@ -31,19 +31,19 @@ import (
// UserLogin Object to recive user credentials in JSON format // UserLogin Object to recive user credentials in JSON format
type UserLogin struct { type UserLogin struct {
// The username used to log in. // The username used to log in.
Username string `json:"username" form:"username"` Username string `json:"username"`
// The password for the user. // The password for the user.
Password string `json:"password" form:"password"` Password string `json:"password"`
} }
// User holds information about an user // User holds information about an user
type User struct { type User struct {
// The unique, numeric id of this user. // The unique, numeric id of this user.
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
// The username of the username. Is always unique. // The username of the user. Is always unique.
Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"` Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(3|250)" minLength:"3" maxLength:"250"`
Password string `xorm:"varchar(250) not null" json:"-"` Password string `xorm:"varchar(250) not null" json:"-"`
// The user's email address // The user's email address.
Email string `xorm:"varchar(250)" json:"email" valid:"email,length(0|250)" maxLength:"250"` Email string `xorm:"varchar(250)" json:"email" valid:"email,length(0|250)" maxLength:"250"`
IsActive bool `json:"-"` IsActive bool `json:"-"`