aboutsummaryrefslogtreecommitdiff
path: root/internal/tracker/types.go
blob: 22837fae668ba95945f7c9ad21f4edf1fbeb6ad0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package tracker

import "time"

type Activity struct {
	ID      int      `json:"id"`
	Title   string   `json:"title"`
	Tags    []string `json:"tags"`
	Context []string `json:"context"`
	Spans   []*Span  `json:"spans"`
}

func (a *Activity) Started() *Span {
	for _, span := range a.Spans {
		if span.Stop == nil {
			return span
		}
	}
	return nil
}

type Span struct {
	Start   time.Time  `json:"start"`
	Stop    *time.Time `json:"stop,omitempty"`
	Comment string     `json:"comment,omitempty"`
}

type Document struct {
	LastKey    int         `json:"last"`
	Activities []*Activity `json:"activities"`
}