draft.go

 1package board
 2
 3import (
 4	"github.com/dustin/go-humanize"
 5
 6	"github.com/MichaelMure/git-bug/entities/common"
 7	"github.com/MichaelMure/git-bug/repository"
 8	"github.com/MichaelMure/git-bug/util/timestamp"
 9)
10
11var _ CardItem = &Draft{}
12
13type Draft struct {
14	status  common.Status
15	title   string
16	message string
17	files   []repository.Hash
18
19	// Creation time of the comment.
20	// Should be used only for human display, never for ordering as we can't rely on it in a distributed system.
21	unixTime timestamp.Timestamp
22}
23
24func (d *Draft) Status() common.Status {
25	// TODO implement me
26	panic("implement me")
27}
28
29// FormatTimeRel format the UnixTime of the comment for human consumption
30func (d *Draft) FormatTimeRel() string {
31	return humanize.Time(d.unixTime.Time())
32}
33
34func (d *Draft) FormatTime() string {
35	return d.unixTime.Time().Format("Mon Jan 2 15:04:05 2006 +0200")
36}
37
38// IsAuthored is a sign post method for gqlgen
39func (d *Draft) IsAuthored() {}