2024-09-18 07:09:25 +02:00
|
|
|
package service
|
2024-09-11 07:50:27 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Kind string
|
|
|
|
|
|
|
|
const (
|
|
|
|
KindTask Kind = "task"
|
|
|
|
KindEvent Kind = "event"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
KnownKinds = []Kind{KindTask, KindEvent}
|
|
|
|
)
|
|
|
|
|
|
|
|
type Item struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
Kind Kind `json:"kind"`
|
|
|
|
Updated time.Time `json:"updated"`
|
|
|
|
Deleted bool `json:"deleted"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewItem(k Kind, body string) Item {
|
|
|
|
return Item{
|
|
|
|
ID: uuid.New().String(),
|
|
|
|
Kind: k,
|
|
|
|
Updated: time.Now(),
|
|
|
|
Body: body,
|
|
|
|
}
|
|
|
|
}
|