package models import "strings" type Node struct { ID string `json:"id"` Title string `json:"title"` Content string `json:"content,omitempty"` DueDate string `json:"due_date,omitempty"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Tags []string `json:"tags,omitempty"` Relations map[string][]string `json:"relations,omitempty"` } type RelType string const ( RelBlocks RelType = "blocks" RelSubtask RelType = "subtask" RelRelated RelType = "related" RelCreated RelType = "created" RelAssignee RelType = "assignee" ) func ParseTag(s string) (key, value string, isProperty bool) { if strings.HasPrefix(s, "_") { if parts := strings.SplitN(s[1:], "::", 2); len(parts) == 2 { return parts[0], parts[1], true } } return "", s, false } func PropertyTag(key, value string) string { return "_" + key + "::" + value } func (n *Node) GetProperty(key string) string { for _, tag := range n.Tags { if k, v, ok := ParseTag(tag); ok && k == key { return v } } return "" } func (n *Node) GetType() string { if t := n.GetProperty("type"); t != "" { return t } return "issue" } func (n *Node) HasTag(tag string) bool { for _, t := range n.Tags { if t == tag { return true } } return false }