wip
This commit is contained in:
parent
94a85d2117
commit
a1e72c0400
5
go.mod
5
go.mod
|
@ -2,4 +2,7 @@ module code.ewintr.nl/planner
|
||||||
|
|
||||||
go 1.21.5
|
go 1.21.5
|
||||||
|
|
||||||
require github.com/google/go-cmp v0.6.0 // indirect
|
require (
|
||||||
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
)
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -1,2 +1,4 @@
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package planner
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Syncable interface {
|
||||||
|
LastUpdated() time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type Task struct {
|
||||||
|
ID string
|
||||||
|
description string
|
||||||
|
updated time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTask(description string) Task {
|
||||||
|
return Task{
|
||||||
|
ID: uuid.New(),
|
||||||
|
description: description,
|
||||||
|
updated: time.Now(),
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,18 @@
|
||||||
package service
|
package storage
|
||||||
|
|
||||||
|
import "code.ewintr.nl/planner/planner"
|
||||||
|
|
||||||
type Memory struct {
|
type Memory struct {
|
||||||
projects map[string]Project
|
projects map[string]planner.Task
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMemory() *Memory {
|
func NewMemory() *Memory {
|
||||||
return &Memory{
|
return &Memory{
|
||||||
projects: make(map[string]Project),
|
projects: make(map[string]planner.Task),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Memory) StoreProject(project Project) error {
|
func (m *Memory) StoreProject(project planner.Task) error {
|
||||||
m.projects[project.ID] = project
|
m.projects[project.ID] = project
|
||||||
|
|
||||||
return nil
|
return nil
|
|
@ -1,4 +1,4 @@
|
||||||
package service_test
|
package storage_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
Loading…
Reference in New Issue