Added more props to caldav todos
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7136a037c5
commit
8972e34960
|
@ -195,6 +195,7 @@ Sorry for some of them being in German, I'll tranlate them at some point.
|
|||
* [ ] Check if only needed things are queried from the db when accessing dav (for ex. no need to get all tasks when we actually only need the title)
|
||||
* [x] Fix OPTIONS Requests to the rest of the api being broken
|
||||
* [ ] Parse all props defined in rfc5545
|
||||
* [ ] COMPLETED -> Need to actually save the time the task was completed
|
||||
* [ ] Tests
|
||||
|
||||
### Refactor
|
||||
|
|
53
docs/content/doc/usage/caldav.md
Normal file
53
docs/content/doc/usage/caldav.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
date: "2019-05-12:00:00+01:00"
|
||||
title: "Caldav"
|
||||
draft: false
|
||||
type: "doc"
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
---
|
||||
|
||||
# Caldav
|
||||
|
||||
Vikunja supports managing tasks via the [caldav VTODO](https://tools.ietf.org/html/rfc5545#section-3.6.2) extension.
|
||||
|
||||
## URLs
|
||||
|
||||
// TODO
|
||||
|
||||
## Supported properties
|
||||
|
||||
Vikunja currently supports the following properties:
|
||||
|
||||
* `UID`
|
||||
* `SUMMARY`
|
||||
* `DESCRIPTION`
|
||||
* `PRIORITY`
|
||||
* `COMPLETED`
|
||||
* `DUE`
|
||||
* `DTSTART`
|
||||
* `DURATION`
|
||||
* `ORGANIZER`
|
||||
* `RELATED-TO`
|
||||
* `CREATED`
|
||||
* `DTSTAMP`
|
||||
* `LAST-MODIFIED`
|
||||
|
||||
Vikunja **does currently not** support these properties:
|
||||
|
||||
* `ATTACH`
|
||||
* `CATEGORIES`
|
||||
* `CLASS`
|
||||
* `COMMENT`
|
||||
* `GEO`
|
||||
* `LOCATION`
|
||||
* `PERCENT-COMPLETE`
|
||||
* `RESOURCES`
|
||||
* `STATUS`
|
||||
* `CONTACT`
|
||||
* `RECURRENCE-ID`
|
||||
* `URL`
|
||||
* Recurrence
|
||||
* `SEQUENCE`
|
||||
|
|
@ -19,6 +19,7 @@ package caldav
|
|||
import (
|
||||
"code.vikunja.io/api/pkg/models"
|
||||
"code.vikunja.io/api/pkg/utils"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
@ -47,9 +48,12 @@ type Todo struct {
|
|||
CompletedUnix int64
|
||||
Organizer *models.User
|
||||
Priority int64 // 0-9, 1 is highest
|
||||
RelatedToUID string
|
||||
|
||||
StartUnix int64
|
||||
EndUnix int64
|
||||
StartUnix int64
|
||||
EndUnix int64
|
||||
DueDateUnix int64
|
||||
Duration time.Duration
|
||||
|
||||
CreatedUnix int64
|
||||
UpdatedUnix int64 // last-mod
|
||||
|
@ -147,6 +151,26 @@ COMPLETED: ` + makeCalDavTimeFromUnixTime(t.CompletedUnix)
|
|||
ORGANIZER;CN=:` + t.Organizer.Username
|
||||
}
|
||||
|
||||
if t.RelatedToUID != "" {
|
||||
caldavtodos += `
|
||||
RELATED-TO:` + t.RelatedToUID
|
||||
}
|
||||
|
||||
if t.DueDateUnix != 0 {
|
||||
caldavtodos += `
|
||||
DUE:` + makeCalDavTimeFromUnixTime(t.DueDateUnix)
|
||||
}
|
||||
|
||||
if t.CreatedUnix != 0 {
|
||||
caldavtodos += `
|
||||
CREATED:` + makeCalDavTimeFromUnixTime(t.CreatedUnix)
|
||||
}
|
||||
|
||||
if t.Duration != 0 {
|
||||
caldavtodos += `
|
||||
DURATION:PT` + fmt.Sprintf("%.6f", t.Duration.Hours()) + `H` + fmt.Sprintf("%.6f", t.Duration.Minutes()) + `M` + fmt.Sprintf("%.6f", t.Duration.Seconds()) + `S`
|
||||
}
|
||||
|
||||
caldavtodos += `
|
||||
PRIORITY:` + strconv.Itoa(int(t.Priority))
|
||||
|
||||
|
|
|
@ -82,9 +82,17 @@ func parseTaskFromVTODO(content string) (vTask *models.ListTask, err error) {
|
|||
// FIXME: add more values to tasks
|
||||
// @see https://tools.ietf.org/html/rfc5545#section-3.8
|
||||
vTask = &models.ListTask{
|
||||
Text: task["SUMMARY"],
|
||||
Priority: priority,
|
||||
UID: task["UID"],
|
||||
Text: task["SUMMARY"],
|
||||
Description: task["DESCRIPTION"],
|
||||
Priority: priority,
|
||||
UID: task["UID"],
|
||||
|
||||
//DueDateUnix: task["DUE"],
|
||||
//COMPLETED (datetime)
|
||||
//StartDateUnix: task["DTSTART"]
|
||||
// DURATION (startdate - enddate)
|
||||
// DTSTAMP (last modified)
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user