Files
ax/models/node.go

36 lines
894 B
Go
Raw Normal View History

2026-03-26 12:48:47 +00:00
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 (n *Node) GetProperty(k string) string {
2026-03-26 12:48:47 +00:00
for _, t := range n.Tags {
if strings.HasPrefix(t, "_") {
if p := strings.SplitN(t[1:], "::", 2); len(p) == 2 && p[0] == k {
return p[1]
}
2026-03-26 12:48:47 +00:00
}
}
return ""
2026-03-26 12:48:47 +00:00
}