refactor: unify tags and edges into single rels table

This commit is contained in:
2026-04-01 12:50:45 +02:00
parent 27c72db042
commit 6288879468
9 changed files with 296 additions and 249 deletions

View File

@@ -31,44 +31,40 @@ type NodeService interface {
}
// AddInput describes a new node to create.
// Tags may include special property tags (_type::, _status::, _prio::); the
// service applies defaults (type=issue, status=open for issues) and validates.
// Rels may include assignee, in_namespace, blocks, subtask, related, etc.;
// user and namespace targets are auto-created as needed.
// Rels may contain tag rels (Target == ""), property rels (Target == "",
// Type is "prefix::value"), and edge rels (Target is a node name or ID).
// The service applies defaults (type=issue, status=open for issues) and validates.
type AddInput struct {
Title string
Content string
DueDate string
Tags []string
Rels []RelInput
}
// UpdateInput describes changes to apply to an existing node.
// Nil pointer fields mean "no change".
// Setting _status::done in AddTags is rejected when the node has open blockers.
// AddRels and RemoveRels accept both tag rels (Target == "") and edge rels.
// Setting _status::done in AddRels is rejected when the node has open blockers.
// Adding assignee or in_namespace rels replaces the previous single target.
type UpdateInput struct {
Title *string
Content *string
DueDate *string // nil = no change; pointer to "" = clear due date
AddTags []string
RemoveTags []string
AddRels []RelInput
RemoveRels []RelInput
}
// ListFilter specifies which nodes to return. Empty slices are ignored.
// Tags are matched as exact tag values or prefixes (e.g. "_status::open").
// Rels are resolved to node IDs; a missing target returns no results.
// Tag filters (Target == "") match by rel_name prefix.
// Edge filters (Target != "") are resolved to node IDs.
type ListFilter struct {
Tags []string
Rels []RelInput
}
// RelInput is a typed, directed edge with a target that may be a name or node ID.
// RelInput is a typed, directed rel with a target that may be a name or node ID.
// Target == "" means this is a tag or property rel (no target node).
type RelInput struct {
Type models.RelType
Target string // name or node ID; the service resolves names
Target string // name or node ID; the service resolves names. Empty = tag rel.
}
func InitNodeService(path string) error {