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",
"password": "12345"
"password": "1234"
}
> {% client.global.set("auth_token", response.body.token); %}

View file

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// 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
@ -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/models.HTTPError"
@ -2888,8 +2888,11 @@ var doc = `{
"listID": {
"type": "integer"
},
"reminderDate": {
"reminderDates": {
"type": "array",
"items": {
"type": "integer"
}
},
"text": {
"type": "string"
@ -3131,12 +3134,18 @@ var doc = `{
"admin": {
"type": "boolean"
},
"created": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"updated": {
"type": "integer"
},
"username": {
"type": "string"
}
@ -3178,12 +3187,18 @@ var doc = `{
"models.User": {
"type": "object",
"properties": {
"created": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"updated": {
"type": "integer"
},
"username": {
"type": "string"
}
@ -3203,6 +3218,9 @@ var doc = `{
"models.UserWithRight": {
"type": "object",
"properties": {
"created": {
"type": "integer"
},
"email": {
"type": "string"
},
@ -3212,6 +3230,9 @@ var doc = `{
"right": {
"type": "integer"
},
"updated": {
"type": "integer"
},
"username": {
"type": "string"
}

View file

@ -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/models.HTTPError"
@ -2875,8 +2875,11 @@
"listID": {
"type": "integer"
},
"reminderDate": {
"reminderDates": {
"type": "array",
"items": {
"type": "integer"
}
},
"text": {
"type": "string"
@ -3118,12 +3121,18 @@
"admin": {
"type": "boolean"
},
"created": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"updated": {
"type": "integer"
},
"username": {
"type": "string"
}
@ -3165,12 +3174,18 @@
"models.User": {
"type": "object",
"properties": {
"created": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"updated": {
"type": "integer"
},
"username": {
"type": "string"
}
@ -3190,6 +3205,9 @@
"models.UserWithRight": {
"type": "object",
"properties": {
"created": {
"type": "integer"
},
"email": {
"type": "string"
},
@ -3199,6 +3217,9 @@
"right": {
"type": "integer"
},
"updated": {
"type": "integer"
},
"username": {
"type": "string"
}

View file

@ -60,8 +60,10 @@ definitions:
type: integer
listID:
type: integer
reminderDate:
reminderDates:
items:
type: integer
type: array
text:
type: string
updated:
@ -219,10 +221,14 @@ definitions:
properties:
admin:
type: boolean
created:
type: integer
email:
type: string
id:
type: integer
updated:
type: integer
username:
type: string
type: object
@ -250,10 +256,14 @@ definitions:
type: object
models.User:
properties:
created:
type: integer
email:
type: string
id:
type: integer
updated:
type: integer
username:
type: string
type: object
@ -266,12 +276,16 @@ definitions:
type: object
models.UserWithRight:
properties:
created:
type: integer
email:
type: string
id:
type: integer
right:
type: integer
updated:
type: integer
username:
type: string
type: object
@ -375,9 +389,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
@ -386,12 +400,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/models.HTTPError'
type: object
@ -402,9 +416,9 @@ paths:
type: object
security:
- ApiKeyAuth: []
summary: Gets one team
summary: Gets one list
tags:
- team
- list
post:
consumes:
- application/json

View file

@ -7,7 +7,7 @@ type ListTask struct {
Description string `xorm:"varchar(250)" json:"description" valid:"runelength(0|250)"`
Done bool `xorm:"INDEX" json:"done"`
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
ListID int64 `xorm:"int(11) INDEX" json:"listID" param:"list"`

View file

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