feat(caldav): Export Labels to Caldav #1409

Merged
konrad merged 2 commits from :main into main 2023-02-27 11:22:44 +00:00
3 changed files with 31 additions and 32 deletions
Showing only changes of commit 0f33f3ad7a - Show all commits

View File

@ -58,13 +58,13 @@ type Todo struct {
Priority int64 // 0-9, 1 is highest Priority int64 // 0-9, 1 is highest
RelatedToUID string RelatedToUID string
Color string Color string
Categories []string Categories []string
Start time.Time Start time.Time
End time.Time End time.Time
DueDate time.Time DueDate time.Time
Duration time.Duration Duration time.Duration
RepeatAfter int64 RepeatAfter int64
RepeatMode models.TaskRepeatMode RepeatMode models.TaskRepeatMode
Created time.Time Created time.Time
Updated time.Time // last-mod Updated time.Time // last-mod

View File

@ -493,11 +493,11 @@ END:VCALENDAR`,
}, },
todos: []*Todo{ todos: []*Todo{
{ {
Summary: "Todo #1", Summary: "Todo #1",
UID: "randommduid", UID: "randommduid",
Timestamp: time.Unix(1543626724, 0).In(config.GetTimeZone()), Timestamp: time.Unix(1543626724, 0).In(config.GetTimeZone()),
Color: "affffe", Color: "affffe",
Categories: []string{"label1", "label2"}, Categories: []string{"label1", "label2"},
}, },
}, },
}, },

View File

@ -100,49 +100,48 @@ END:VCALENDAR`,
} }
} }
func TestFormatTaskAsVTODO(t *testing.T) { func TestGetCaldavTodosForTasks(t *testing.T) {
type args struct { type args struct {
list *models.ListWithTasksAndBuckets list *models.ListWithTasksAndBuckets
tasks []*models.TaskWithComments tasks []*models.TaskWithComments
} }
tests := []struct { tests := []struct {
name string name string
args args args args
wantCaldav string wantCaldav string
}{ }{
{ {
name: "Format single Task as Caldav", name: "Format single Task as Caldav",
args: args{ args: args{
list: &models.ListWithTasksAndBuckets{ list: &models.ListWithTasksAndBuckets{
List: models.List{ List: models.List{
Title: "List title", Title: "List title",
}, },
}, },
tasks: []*models.TaskWithComments{ tasks: []*models.TaskWithComments{
{ {
Task: models.Task{ Task: models.Task{
Title: "Task 1", Title: "Task 1",
UID: "randomuid", UID: "randomuid",
Description: "Description", Description: "Description",
Priority: 3, Priority: 3,
Created: time.Unix(1543626721, 0).In(config.GetTimeZone()), Created: time.Unix(1543626721, 0).In(config.GetTimeZone()),
DueDate: time.Unix(1543626722, 0).In(config.GetTimeZone()), DueDate: time.Unix(1543626722, 0).In(config.GetTimeZone()),
StartDate: time.Unix(1543626723, 0).In(config.GetTimeZone()), StartDate: time.Unix(1543626723, 0).In(config.GetTimeZone()),
EndDate: time.Unix(1543626724, 0).In(config.GetTimeZone()), EndDate: time.Unix(1543626724, 0).In(config.GetTimeZone()),
Updated: time.Unix(1543626725, 0).In(config.GetTimeZone()), Updated: time.Unix(1543626725, 0).In(config.GetTimeZone()),
DoneAt: time.Unix(1543626726, 0).In(config.GetTimeZone()), DoneAt: time.Unix(1543626726, 0).In(config.GetTimeZone()),
RepeatAfter: 86400, RepeatAfter: 86400,
Labels: []*models.Label{ Labels: []*models.Label{
{ {
ID: 1, ID: 1,
Title: "label1", Title: "label1",
}, },
{ {
ID: 2, ID: 2,
Title: "label2", Title: "label2",
}, },
}, },
}, },
}, },
}, },