feat(caldav): Export Labels to Caldav
continuous-integration/drone/pr Build is passing Details

Relates to vikunja/api#1274
This commit is contained in:
cernst 2023-02-25 23:03:29 +01:00
parent cd9850e757
commit 0f33f3ad7a
3 changed files with 31 additions and 32 deletions

View File

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

View File

@ -493,11 +493,11 @@ END:VCALENDAR`,
},
todos: []*Todo{
{
Summary: "Todo #1",
UID: "randommduid",
Timestamp: time.Unix(1543626724, 0).In(config.GetTimeZone()),
Color: "affffe",
Categories: []string{"label1", "label2"},
Summary: "Todo #1",
UID: "randommduid",
Timestamp: time.Unix(1543626724, 0).In(config.GetTimeZone()),
Color: "affffe",
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 {
list *models.ListWithTasksAndBuckets
list *models.ListWithTasksAndBuckets
tasks []*models.TaskWithComments
}
tests := []struct {
name string
args args
name string
args args
wantCaldav string
}{
{
name: "Format single Task as Caldav",
args: args{
list: &models.ListWithTasksAndBuckets{
List: models.List{
Title: "List title",
list: &models.ListWithTasksAndBuckets{
List: models.List{
Title: "List title",
},
},
tasks: []*models.TaskWithComments{
tasks: []*models.TaskWithComments{
{
Task: models.Task{
Title: "Task 1",
UID: "randomuid",
Title: "Task 1",
UID: "randomuid",
Description: "Description",
Priority: 3,
Created: time.Unix(1543626721, 0).In(config.GetTimeZone()),
DueDate: time.Unix(1543626722, 0).In(config.GetTimeZone()),
StartDate: time.Unix(1543626723, 0).In(config.GetTimeZone()),
EndDate: time.Unix(1543626724, 0).In(config.GetTimeZone()),
Updated: time.Unix(1543626725, 0).In(config.GetTimeZone()),
DoneAt: time.Unix(1543626726, 0).In(config.GetTimeZone()),
Priority: 3,
Created: time.Unix(1543626721, 0).In(config.GetTimeZone()),
DueDate: time.Unix(1543626722, 0).In(config.GetTimeZone()),
StartDate: time.Unix(1543626723, 0).In(config.GetTimeZone()),
EndDate: time.Unix(1543626724, 0).In(config.GetTimeZone()),
Updated: time.Unix(1543626725, 0).In(config.GetTimeZone()),
DoneAt: time.Unix(1543626726, 0).In(config.GetTimeZone()),
RepeatAfter: 86400,
Labels: []*models.Label{
{
ID: 1,
ID: 1,
Title: "label1",
},
{
ID: 2,
ID: 2,
Title: "label2",
},
},
},
},
},