39 рядки
707 B
Go
39 рядки
707 B
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type ItemStatus string
|
|
|
|
const (
|
|
ItemStatusOpen ItemStatus = "open"
|
|
ItemStatusDone ItemStatus = "done"
|
|
)
|
|
|
|
type Urgency string
|
|
|
|
const (
|
|
UrgencyLow Urgency = "low"
|
|
UrgencyNormal Urgency = "normal"
|
|
UrgencyHigh Urgency = "high"
|
|
)
|
|
|
|
type Item struct {
|
|
ID int64
|
|
ListID int64
|
|
Title string
|
|
Note string
|
|
Quantity float64
|
|
Urgency Urgency
|
|
Status ItemStatus
|
|
ReservedByID *int64
|
|
ReservedAt *time.Time
|
|
CompletedAt *time.Time
|
|
CreatedByID int64
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func (i Item) Reserved() bool { return i.ReservedByID != nil }
|
|
|
|
func (i Item) Done() bool { return i.Status == ItemStatusDone }
|