Fixed duedate spelling issue (#79)

This commit is contained in:
konrad 2019-05-31 08:10:56 +00:00 committed by Gitea
parent f638fae4fd
commit 7acf318b28
6 changed files with 39 additions and 32 deletions

View File

@ -94,12 +94,12 @@ func TestListTask(t *testing.T) {
}) })
// should equal duedate desc // should equal duedate desc
t.Run("by duedate", func(t *testing.T) { t.Run("by duedate", func(t *testing.T) {
rec, err := testHandler.testReadAll(url.Values{"sort": []string{"dueadate"}}, nil) rec, err := testHandler.testReadAll(url.Values{"sort": []string{"duedate"}}, nil)
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, rec.Body.String(), `[{"id":5,"text":"task #5 higher due date","description":"","done":false,"doneAt":0,"dueDate":1543636724,"reminderDates":null,"listID":1,"repeatAfter":0,"parentTaskID":0,"priority":0,"startDate":0,"endDate":0,"assignees":null,"labels":null,"hexColor":"","subtasks":null,"created":1543626724,"updated":1543626724,"createdBy":{"id":1,"username":"user1","avatarUrl":"111d68d06e2d317b5a59c2c6c5bad808","created":0,"updated":0}},{"id":6,"text":"task #6 lower due date"`) assert.Contains(t, rec.Body.String(), `[{"id":5,"text":"task #5 higher due date","description":"","done":false,"doneAt":0,"dueDate":1543636724,"reminderDates":null,"listID":1,"repeatAfter":0,"parentTaskID":0,"priority":0,"startDate":0,"endDate":0,"assignees":null,"labels":null,"hexColor":"","subtasks":null,"created":1543626724,"updated":1543626724,"createdBy":{"id":1,"username":"user1","avatarUrl":"111d68d06e2d317b5a59c2c6c5bad808","created":0,"updated":0}},{"id":6,"text":"task #6 lower due date"`)
}) })
t.Run("by duedate desc", func(t *testing.T) { t.Run("by duedate desc", func(t *testing.T) {
rec, err := testHandler.testReadAll(url.Values{"sort": []string{"dueadatedesc"}}, nil) rec, err := testHandler.testReadAll(url.Values{"sort": []string{"duedatedesc"}}, nil)
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, rec.Body.String(), `[{"id":5,"text":"task #5 higher due date","description":"","done":false,"doneAt":0,"dueDate":1543636724,"reminderDates":null,"listID":1,"repeatAfter":0,"parentTaskID":0,"priority":0,"startDate":0,"endDate":0,"assignees":null,"labels":null,"hexColor":"","subtasks":null,"created":1543626724,"updated":1543626724,"createdBy":{"id":1,"username":"user1","avatarUrl":"111d68d06e2d317b5a59c2c6c5bad808","created":0,"updated":0}},{"id":6,"text":"task #6 lower due date"`) assert.Contains(t, rec.Body.String(), `[{"id":5,"text":"task #5 higher due date","description":"","done":false,"doneAt":0,"dueDate":1543636724,"reminderDates":null,"listID":1,"repeatAfter":0,"parentTaskID":0,"priority":0,"startDate":0,"endDate":0,"assignees":null,"labels":null,"hexColor":"","subtasks":null,"created":1543626724,"updated":1543626724,"createdBy":{"id":1,"username":"user1","avatarUrl":"111d68d06e2d317b5a59c2c6c5bad808","created":0,"updated":0}},{"id":6,"text":"task #6 lower due date"`)
}) })

View File

@ -32,7 +32,7 @@ const (
// @Produce 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 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 s query string false "Search tasks by task text."
// @Param sort query string false "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc." // @Param sort query string false "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, duedate, duedatedesc, duedateasc."
// @Param startdate query int false "The start date parameter to filter by. Expects a unix timestamp. If no end date, but a start date is specified, the end date is set to the current time." // @Param startdate query int false "The start date parameter to filter by. Expects a unix timestamp. If no end date, but a start date is specified, the end date is set to the current time."
// @Param enddate query int false "The end date parameter to filter by. Expects a unix timestamp. If no start date, but an end date is specified, the start date is set to the current time." // @Param enddate query int false "The end date parameter to filter by. Expects a unix timestamp. If no start date, but an end date is specified, the start date is set to the current time."
// @Security JWTKeyAuth // @Security JWTKeyAuth
@ -53,9 +53,9 @@ func (t *ListTask) ReadAll(search string, a web.Auth, page int) (interface{}, er
sortby = SortTasksByPriorityDesc sortby = SortTasksByPriorityDesc
case "priorityasc": case "priorityasc":
sortby = SortTasksByPriorityAsc sortby = SortTasksByPriorityAsc
case "dueadate": case "duedate":
sortby = SortTasksByDueDateDesc sortby = SortTasksByDueDateDesc
case "dueadatedesc": case "duedatedesc":
sortby = SortTasksByDueDateDesc sortby = SortTasksByDueDateDesc
case "duedateasc": case "duedateasc":
sortby = SortTasksByDueDateAsc sortby = SortTasksByDueDateAsc

View File

@ -440,7 +440,7 @@ func TestListTask_ReadAll(t *testing.T) {
{ {
name: "ReadAll ListTasks sorted by due date default desc", name: "ReadAll ListTasks sorted by due date default desc",
fields: fields{ fields: fields{
Sorting: "dueadate", Sorting: "duedate",
}, },
args: args{ args: args{
search: "", search: "",
@ -466,7 +466,7 @@ func TestListTask_ReadAll(t *testing.T) {
{ {
name: "ReadAll ListTasks sorted by due date desc", name: "ReadAll ListTasks sorted by due date desc",
fields: fields{ fields: fields{
Sorting: "dueadatedesc", Sorting: "duedatedesc",
}, },
args: args{ args: args{
search: "", search: "",

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-05-30 23:45:13.052367163 +0200 CEST m=+0.289150504 // 2019-05-31 09:26:58.634329804 +0200 CEST m=+0.271816386
package swagger package swagger
@ -14,7 +14,7 @@ import (
var doc = `{ var doc = `{
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e", "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",
"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 an array with all assignees for this task.", "description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -45,9 +45,9 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"assignees" "labels"
], ],
"summary": "Get all assignees for a task", "summary": "Get all labels a user has access to",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -57,18 +57,18 @@ var doc = `{
}, },
{ {
"type": "string", "type": "string",
"description": "Search assignees by their username.", "description": "Search labels by label text.",
"name": "s", "name": "s",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The assignees", "description": "The labels",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.Label"
} }
} }
}, },
@ -2282,7 +2282,7 @@ var doc = `{
}, },
{ {
"type": "string", "type": "string",
"description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, duedate, duedatedesc, duedateasc.",
"name": "sort", "name": "sort",
"in": "query" "in": "query"
}, },

View File

@ -1,7 +1,7 @@
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "\u003c!-- ReDoc-Inject: \u003csecurity-definitions\u003e --\u003e", "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",
"title": "Vikunja API", "title": "Vikunja API",
"contact": { "contact": {
"name": "General Vikunja contact", "name": "General Vikunja contact",
@ -24,7 +24,7 @@
"JWTKeyAuth": [] "JWTKeyAuth": []
} }
], ],
"description": "Returns an array with all assignees for this task.", "description": "Returns all labels which are either created by the user or associated with a task the user has at least read-access to.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -32,9 +32,9 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"assignees" "labels"
], ],
"summary": "Get all assignees for a task", "summary": "Get all labels a user has access to",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -44,18 +44,18 @@
}, },
{ {
"type": "string", "type": "string",
"description": "Search assignees by their username.", "description": "Search labels by label text.",
"name": "s", "name": "s",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The assignees", "description": "The labels",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.User" "$ref": "#/definitions/models.Label"
} }
} }
}, },
@ -2269,7 +2269,7 @@
}, },
{ {
"type": "string", "type": "string",
"description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc.", "description": "The sorting parameter. Possible values to sort by are priority, prioritydesc, priorityasc, duedate, duedatedesc, duedateasc.",
"name": "sort", "name": "sort",
"in": "query" "in": "query"
}, },

View File

@ -664,7 +664,13 @@ 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: '<!-- ReDoc-Inject: <security-definitions> -->' 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. <!-- 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
@ -675,14 +681,15 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: Returns an array with all assignees for this task. description: Returns all labels which are either created by the user or associated
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 assignees by their username. - description: Search labels by label text.
in: query in: query
name: s name: s
type: string type: string
@ -690,10 +697,10 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: The assignees description: The labels
schema: schema:
items: items:
$ref: '#/definitions/models.User' $ref: '#/definitions/models.Label'
type: array type: array
"500": "500":
description: Internal error description: Internal error
@ -702,9 +709,9 @@ paths:
type: object type: object
security: security:
- JWTKeyAuth: [] - JWTKeyAuth: []
summary: Get all assignees for a task summary: Get all labels a user has access to
tags: tags:
- assignees - labels
put: put:
consumes: consumes:
- application/json - application/json
@ -2572,7 +2579,7 @@ paths:
name: s name: s
type: string type: string
- description: The sorting parameter. Possible values to sort by are priority, - description: The sorting parameter. Possible values to sort by are priority,
prioritydesc, priorityasc, dueadate, dueadatedesc, dueadateasc. prioritydesc, priorityasc, duedate, duedatedesc, duedateasc.
in: query in: query
name: sort name: sort
type: string type: string