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"
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-27 02:11:46 +01:00
|
|
|
func (n *Node) GetProperty(k string) string {
|
2026-03-26 12:48:47 +00:00
|
|
|
for _, t := range n.Tags {
|
2026-03-27 02:11:46 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
2026-03-27 02:11:46 +01:00
|
|
|
return ""
|
2026-03-26 12:48:47 +00:00
|
|
|
}
|