Multiple Reminders (#22)

This commit is contained in:
konrad 2018-11-21 15:03:47 +00:00 committed by Gitea
parent af0ce5bb96
commit fded3c23d0
6 changed files with 97 additions and 39 deletions

View File

@ -4,7 +4,7 @@ Content-Type: application/json
{ {
"username": "user", "username": "user",
"password": "12345" "password": "1234"
} }
> {% client.global.set("auth_token", response.body.token); %} > {% client.global.set("auth_token", response.body.token); %}

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
// 2018-11-12 16:13:09.593331747 +0100 CET m=+0.083002310 // 2018-11-20 14:02:38.646137557 +0100 CET m=+0.072751301
package docs package docs
@ -91,7 +91,7 @@ var doc = `{
"ApiKeyAuth": [] "ApiKeyAuth": []
} }
], ],
"description": "Returns a team by its ID.", "description": "Returns a list by its ID.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -99,13 +99,13 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"team" "list"
], ],
"summary": "Gets one team", "summary": "Gets one list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"description": "Team ID", "description": "List ID",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
@ -113,14 +113,14 @@ var doc = `{
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The team", "description": "The list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Team" "$ref": "#/definitions/models.List"
} }
}, },
"403": { "403": {
"description": "The user does not have access to the team", "description": "The user does not have access to the list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.HTTPError" "$ref": "#/definitions/models.HTTPError"
@ -2888,8 +2888,11 @@ var doc = `{
"listID": { "listID": {
"type": "integer" "type": "integer"
}, },
"reminderDate": { "reminderDates": {
"type": "integer" "type": "array",
"items": {
"type": "integer"
}
}, },
"text": { "text": {
"type": "string" "type": "string"
@ -3131,12 +3134,18 @@ var doc = `{
"admin": { "admin": {
"type": "boolean" "type": "boolean"
}, },
"created": {
"type": "integer"
},
"email": { "email": {
"type": "string" "type": "string"
}, },
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"updated": {
"type": "integer"
},
"username": { "username": {
"type": "string" "type": "string"
} }
@ -3178,12 +3187,18 @@ var doc = `{
"models.User": { "models.User": {
"type": "object", "type": "object",
"properties": { "properties": {
"created": {
"type": "integer"
},
"email": { "email": {
"type": "string" "type": "string"
}, },
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"updated": {
"type": "integer"
},
"username": { "username": {
"type": "string" "type": "string"
} }
@ -3203,6 +3218,9 @@ var doc = `{
"models.UserWithRight": { "models.UserWithRight": {
"type": "object", "type": "object",
"properties": { "properties": {
"created": {
"type": "integer"
},
"email": { "email": {
"type": "string" "type": "string"
}, },
@ -3212,6 +3230,9 @@ var doc = `{
"right": { "right": {
"type": "integer" "type": "integer"
}, },
"updated": {
"type": "integer"
},
"username": { "username": {
"type": "string" "type": "string"
} }

View File

@ -78,7 +78,7 @@
"ApiKeyAuth": [] "ApiKeyAuth": []
} }
], ],
"description": "Returns a team by its ID.", "description": "Returns a list by its ID.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@ -86,13 +86,13 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"team" "list"
], ],
"summary": "Gets one team", "summary": "Gets one list",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"description": "Team ID", "description": "List ID",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
@ -100,14 +100,14 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "The team", "description": "The list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.Team" "$ref": "#/definitions/models.List"
} }
}, },
"403": { "403": {
"description": "The user does not have access to the team", "description": "The user does not have access to the list",
"schema": { "schema": {
"type": "object", "type": "object",
"$ref": "#/definitions/models.HTTPError" "$ref": "#/definitions/models.HTTPError"
@ -2875,8 +2875,11 @@
"listID": { "listID": {
"type": "integer" "type": "integer"
}, },
"reminderDate": { "reminderDates": {
"type": "integer" "type": "array",
"items": {
"type": "integer"
}
}, },
"text": { "text": {
"type": "string" "type": "string"
@ -3118,12 +3121,18 @@
"admin": { "admin": {
"type": "boolean" "type": "boolean"
}, },
"created": {
"type": "integer"
},
"email": { "email": {
"type": "string" "type": "string"
}, },
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"updated": {
"type": "integer"
},
"username": { "username": {
"type": "string" "type": "string"
} }
@ -3165,12 +3174,18 @@
"models.User": { "models.User": {
"type": "object", "type": "object",
"properties": { "properties": {
"created": {
"type": "integer"
},
"email": { "email": {
"type": "string" "type": "string"
}, },
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"updated": {
"type": "integer"
},
"username": { "username": {
"type": "string" "type": "string"
} }
@ -3190,6 +3205,9 @@
"models.UserWithRight": { "models.UserWithRight": {
"type": "object", "type": "object",
"properties": { "properties": {
"created": {
"type": "integer"
},
"email": { "email": {
"type": "string" "type": "string"
}, },
@ -3199,6 +3217,9 @@
"right": { "right": {
"type": "integer" "type": "integer"
}, },
"updated": {
"type": "integer"
},
"username": { "username": {
"type": "string" "type": "string"
} }

View File

@ -60,8 +60,10 @@ definitions:
type: integer type: integer
listID: listID:
type: integer type: integer
reminderDate: reminderDates:
type: integer items:
type: integer
type: array
text: text:
type: string type: string
updated: updated:
@ -219,10 +221,14 @@ definitions:
properties: properties:
admin: admin:
type: boolean type: boolean
created:
type: integer
email: email:
type: string type: string
id: id:
type: integer type: integer
updated:
type: integer
username: username:
type: string type: string
type: object type: object
@ -250,10 +256,14 @@ definitions:
type: object type: object
models.User: models.User:
properties: properties:
created:
type: integer
email: email:
type: string type: string
id: id:
type: integer type: integer
updated:
type: integer
username: username:
type: string type: string
type: object type: object
@ -266,12 +276,16 @@ definitions:
type: object type: object
models.UserWithRight: models.UserWithRight:
properties: properties:
created:
type: integer
email: email:
type: string type: string
id: id:
type: integer type: integer
right: right:
type: integer type: integer
updated:
type: integer
username: username:
type: string type: string
type: object type: object
@ -375,9 +389,9 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: Returns a team by its ID. description: Returns a list by its ID.
parameters: parameters:
- description: Team ID - description: List ID
in: path in: path
name: id name: id
required: true required: true
@ -386,12 +400,12 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: The team description: The list
schema: schema:
$ref: '#/definitions/models.Team' $ref: '#/definitions/models.List'
type: object type: object
"403": "403":
description: The user does not have access to the team description: The user does not have access to the list
schema: schema:
$ref: '#/definitions/models.HTTPError' $ref: '#/definitions/models.HTTPError'
type: object type: object
@ -402,9 +416,9 @@ paths:
type: object type: object
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Gets one team summary: Gets one list
tags: tags:
- team - list
post: post:
consumes: consumes:
- application/json - application/json

View File

@ -2,14 +2,14 @@ package models
// ListTask represents an task in a todolist // ListTask represents an task in a todolist
type ListTask struct { type ListTask struct {
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"listtask"` ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id" param:"listtask"`
Text string `xorm:"varchar(250)" json:"text" valid:"runelength(5|250)"` Text string `xorm:"varchar(250)" json:"text" valid:"runelength(5|250)"`
Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)"` Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)"`
Done bool `xorm:"INDEX" json:"done"` Done bool `xorm:"INDEX" json:"done"`
DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"` DueDateUnix int64 `xorm:"int(11) INDEX" json:"dueDate"`
ReminderUnix int64 `xorm:"int(11) INDEX" json:"reminderDate"` 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
ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"` ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"`
Created int64 `xorm:"created" json:"created" valid:"range(0|0)"` Created int64 `xorm:"created" json:"created" valid:"range(0|0)"`
Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"` Updated int64 `xorm:"updated" json:"updated" valid:"range(0|0)"`

View File

@ -54,8 +54,10 @@ func Caldav(c echo.Context) error {
EndUnix: t.DueDateUnix + hour, EndUnix: t.DueDateUnix + hour,
} }
if t.ReminderUnix != 0 { if len(t.RemindersUnix) > 0 {
event.Alarms = append(event.Alarms, caldav.Alarm{TimeUnix: t.ReminderUnix}) for _, rem := range t.RemindersUnix {
event.Alarms = append(event.Alarms, caldav.Alarm{TimeUnix: rem})
}
} }
caldavTasks = append(caldavTasks, event) caldavTasks = append(caldavTasks, event)