refactor: add tag and relation methods to node to enforce integrity

This commit is contained in:
2026-03-29 23:16:44 +02:00
parent 4ebcb88628
commit dadd3d9e13
15 changed files with 313 additions and 179 deletions

View File

@@ -25,21 +25,16 @@ func GetNodeService(cfg Config) (NodeService, error) {
}
type listFilter struct {
tagPrefixes []string
assignee string
mentionsUser string
tagPrefixes []string
relPrefixes []*models.Rel
}
type ListOption func(*listFilter)
func WithTags(prefixes ...string) ListOption {
return func(f *listFilter) { f.tagPrefixes = prefixes }
return func(f *listFilter) { f.tagPrefixes = append(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 }
func WithRels(prefixes ...*models.Rel) ListOption {
return func(f *listFilter) { f.relPrefixes = append(f.relPrefixes, prefixes...) }
}