diff --git a/docs/docs.go b/docs/docs.go index f0d96f5b7d..7bdde0a755 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2018-12-22 16:18:46.44967995 +0100 CET m=+0.133725013 +// 2018-12-25 21:44:18.815676554 +0100 CET m=+0.161606284 package docs @@ -91,7 +91,7 @@ var doc = `{ "ApiKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -99,13 +99,13 @@ var doc = `{ "application/json" ], "tags": [ - "team" + "list" ], - "summary": "Gets one team", + "summary": "Gets one list", "parameters": [ { "type": "integer", - "description": "Team ID", + "description": "List ID", "name": "id", "in": "path", "required": true @@ -113,14 +113,14 @@ var doc = `{ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { "type": "object", - "$ref": "#/definitions/models.Team" + "$ref": "#/definitions/models.List" } }, "403": { - "description": "The user does not have access to the team", + "description": "The user does not have access to the list", "schema": { "type": "object", "$ref": "#/definitions/code.vikunja.io.web.HTTPError" @@ -1949,7 +1949,7 @@ var doc = `{ } } }, - "/tasks": { + "/tasks/all": { "get": { "security": [ { @@ -2001,6 +2001,138 @@ var doc = `{ } } }, + "/tasks/all/{sortby}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted", + "parameters": [ + { + "type": "integer", + "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", + "name": "p", + "in": "query" + }, + { + "type": "string", + "description": "Search tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, + "/tasks/all/{sortby}/{startdate}/{enddate}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted and within a date range", + "parameters": [ + { + "type": "integer", + "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", + "name": "p", + "in": "query" + }, + { + "type": "string", + "description": "Search tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The start date parameter. Expects a unix timestamp.", + "name": "startdate", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The end date parameter. Expects a unix timestamp.", + "name": "enddate", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/tasks/caldav": { "get": { "security": [ @@ -2155,65 +2287,6 @@ var doc = `{ } } }, - "/tasks/{sortby}": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Returns all tasks on any list the user has access to.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "task" - ], - "summary": "Get tasks sorted", - "parameters": [ - { - "type": "integer", - "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", - "name": "p", - "in": "query" - }, - { - "type": "string", - "description": "Search tasks by task text.", - "name": "s", - "in": "query" - }, - { - "type": "string", - "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", - "name": "sortby", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "The tasks", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/models.List" - } - } - }, - "500": { - "description": "Internal error", - "schema": { - "type": "object", - "$ref": "#/definitions/models.Message" - } - } - } - } - }, "/teams": { "get": { "security": [ diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index dfd885940c..f840769ac5 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -78,7 +78,7 @@ "ApiKeyAuth": [] } ], - "description": "Returns a team by its ID.", + "description": "Returns a list by its ID.", "consumes": [ "application/json" ], @@ -86,13 +86,13 @@ "application/json" ], "tags": [ - "team" + "list" ], - "summary": "Gets one team", + "summary": "Gets one list", "parameters": [ { "type": "integer", - "description": "Team ID", + "description": "List ID", "name": "id", "in": "path", "required": true @@ -100,14 +100,14 @@ ], "responses": { "200": { - "description": "The team", + "description": "The list", "schema": { "type": "object", - "$ref": "#/definitions/models.Team" + "$ref": "#/definitions/models.List" } }, "403": { - "description": "The user does not have access to the team", + "description": "The user does not have access to the list", "schema": { "type": "object", "$ref": "#/definitions/code.vikunja.io/web.HTTPError" @@ -1936,7 +1936,7 @@ } } }, - "/tasks": { + "/tasks/all": { "get": { "security": [ { @@ -1988,6 +1988,138 @@ } } }, + "/tasks/all/{sortby}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted", + "parameters": [ + { + "type": "integer", + "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", + "name": "p", + "in": "query" + }, + { + "type": "string", + "description": "Search tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, + "/tasks/all/{sortby}/{startdate}/{enddate}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Returns all tasks on any list the user has access to.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "task" + ], + "summary": "Get tasks sorted and within a date range", + "parameters": [ + { + "type": "integer", + "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", + "name": "p", + "in": "query" + }, + { + "type": "string", + "description": "Search tasks by task text.", + "name": "s", + "in": "query" + }, + { + "type": "string", + "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", + "name": "sortby", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The start date parameter. Expects a unix timestamp.", + "name": "startdate", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The end date parameter. Expects a unix timestamp.", + "name": "enddate", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "The tasks", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/models.List" + } + } + }, + "500": { + "description": "Internal error", + "schema": { + "type": "object", + "$ref": "#/definitions/models.Message" + } + } + } + } + }, "/tasks/caldav": { "get": { "security": [ @@ -2142,65 +2274,6 @@ } } }, - "/tasks/{sortby}": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Returns all tasks on any list the user has access to.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "task" - ], - "summary": "Get tasks sorted", - "parameters": [ - { - "type": "integer", - "description": "The page number. Used for pagination. If not provided, the first page of results is returned.", - "name": "p", - "in": "query" - }, - { - "type": "string", - "description": "Search tasks by task text.", - "name": "s", - "in": "query" - }, - { - "type": "string", - "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", - "name": "sortby", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "The tasks", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/models.List" - } - } - }, - "500": { - "description": "Internal error", - "schema": { - "type": "object", - "$ref": "#/definitions/models.Message" - } - } - } - } - }, "/teams": { "get": { "security": [ diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 97a6210caf..a4fe31bab7 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -396,9 +396,9 @@ paths: get: consumes: - application/json - description: Returns a team by its ID. + description: Returns a list by its ID. parameters: - - description: Team ID + - description: List ID in: path name: id required: true @@ -407,12 +407,12 @@ paths: - application/json responses: "200": - description: The team + description: The list schema: - $ref: '#/definitions/models.Team' + $ref: '#/definitions/models.List' type: object "403": - description: The user does not have access to the team + description: The user does not have access to the list schema: $ref: '#/definitions/code.vikunja.io/web.HTTPError' type: object @@ -423,9 +423,9 @@ paths: type: object security: - ApiKeyAuth: [] - summary: Gets one team + summary: Gets one list tags: - - team + - list post: consumes: - application/json @@ -1616,40 +1616,6 @@ paths: summary: Register tags: - user - /tasks: - get: - consumes: - - application/json - description: Returns all tasks on any list the user has access to. - parameters: - - description: The page number. Used for pagination. If not provided, the first - page of results is returned. - in: query - name: p - type: integer - - description: Search tasks by task text. - in: query - name: s - type: string - produces: - - application/json - responses: - "200": - description: The tasks - schema: - items: - $ref: '#/definitions/models.List' - type: array - "500": - description: Internal error - schema: - $ref: '#/definitions/models.Message' - type: object - security: - - ApiKeyAuth: [] - summary: Get tasks - tags: - - task /tasks/{id}: delete: description: Deletes a task from a list. This does not mean "mark it done". @@ -1732,7 +1698,41 @@ paths: summary: Update a task tags: - task - /tasks/{sortby}: + /tasks/all: + get: + consumes: + - application/json + description: Returns all tasks on any list the user has access to. + parameters: + - description: The page number. Used for pagination. If not provided, the first + page of results is returned. + in: query + name: p + type: integer + - description: Search tasks by task text. + in: query + name: s + type: string + produces: + - application/json + responses: + "200": + description: The tasks + schema: + items: + $ref: '#/definitions/models.List' + type: array + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + type: object + security: + - ApiKeyAuth: [] + summary: Get tasks + tags: + - task + /tasks/all/{sortby}: get: consumes: - application/json @@ -1772,6 +1772,56 @@ paths: summary: Get tasks sorted tags: - task + /tasks/all/{sortby}/{startdate}/{enddate}: + get: + consumes: + - application/json + description: Returns all tasks on any list the user has access to. + parameters: + - description: The page number. Used for pagination. If not provided, the first + page of results is returned. + in: query + name: p + type: integer + - description: Search tasks by task text. + in: query + name: s + type: string + - description: The sorting parameter. Possible values to sort by are priority, + prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc. + in: path + name: sortby + required: true + type: string + - description: The start date parameter. Expects a unix timestamp. + in: path + name: startdate + required: true + type: string + - description: The end date parameter. Expects a unix timestamp. + in: path + name: enddate + required: true + type: string + produces: + - application/json + responses: + "200": + description: The tasks + schema: + items: + $ref: '#/definitions/models.List' + type: array + "500": + description: Internal error + schema: + $ref: '#/definitions/models.Message' + type: object + security: + - ApiKeyAuth: [] + summary: Get tasks sorted and within a date range + tags: + - task /tasks/caldav: get: description: Returns a calDAV-parsable format with all tasks as calendar events. diff --git a/pkg/models/list_task_readall.go b/pkg/models/list_task_readall.go index e452a3f47a..19fe68849d 100644 --- a/pkg/models/list_task_readall.go +++ b/pkg/models/list_task_readall.go @@ -35,11 +35,30 @@ const ( // @Security ApiKeyAuth // @Success 200 {array} models.List "The tasks" // @Failure 500 {object} models.Message "Internal error" -// @Router /tasks/{sortby} [get] +// @Router /tasks/all/{sortby} [get] func dummy() { // Dummy function for swaggo to pick up the docs comment } +// ReadAllWithPriorityAndDateRange gets all tasks for a user, sorted +// @Summary Get tasks sorted and within a date range +// @Description Returns all tasks on any list the user has access to. +// @tags task +// @Accept json +// @Produce json +// @Param p query int false "The page number. Used for pagination. If not provided, the first page of results is returned." +// @Param s query string false "Search tasks by task text." +// @Param sortby path string true "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc." +// @Param startdate path string true "The start date parameter. Expects a unix timestamp." +// @Param enddate path string true "The end date parameter. Expects a unix timestamp." +// @Security ApiKeyAuth +// @Success 200 {array} models.List "The tasks" +// @Failure 500 {object} models.Message "Internal error" +// @Router /tasks/all/{sortby}/{startdate}/{enddate} [get] +func dummy2() { + // Dummy function for swaggo to pick up the docs comment +} + // ReadAll gets all tasks for a user // @Summary Get tasks // @Description Returns all tasks on any list the user has access to. @@ -51,7 +70,7 @@ func dummy() { // @Security ApiKeyAuth // @Success 200 {array} models.List "The tasks" // @Failure 500 {object} models.Message "Internal error" -// @Router /tasks [get] +// @Router /tasks/all [get] func (lt *ListTask) ReadAll(search string, a web.Auth, page int) (interface{}, error) { u, err := getUserWithError(a) if err != nil {