Files
ax/service/node_service.go

34 lines
853 B
Go

package service
import "axolotl/models"
type NodeService interface {
Create(title, content, dueDate string, tags []string, rels map[models.RelType][]string) (*models.Node, error)
Update(node *models.Node) error
Delete(id string) error
GetByID(id string) (*models.Node, error)
List(opts ...ListOption) ([]*models.Node, error)
Exists(id string) (bool, error)
CanClose(id string) (bool, []string, error)
}
type listFilter struct {
tagPrefixes []string
assignee string
mentionsUser string
}
type ListOption func(*listFilter)
func WithTags(prefixes ...string) ListOption {
return func(f *listFilter) { f.tagPrefixes = prefixes }
}
func WithAssignee(userID string) ListOption {
return func(f *listFilter) { f.assignee = userID }
}
func WithMentions(userID string) ListOption {
return func(f *listFilter) { f.mentionsUser = userID }
}