feat: replace in_namespace relation with ownership-based namespace membership
Remove the in_namespace edge relation. A node now belongs to a namespace if that namespace has has_ownership on it. This simplifies the model: namespace membership is determined by the ownership chain rather than a separate relation type. Changes: - Remove RelInNamespace constant - Add Namespace fields to AddInput, UpdateInput, and ListFilter - Update Add() to resolve namespace from input and assign it as owner - Update List() to filter by namespace ownership instead of in_namespace edges - Update() can now transfer nodes between namespaces via ownership transfer - Remove in_namespace self-references from ensureNamespace/ensureGlobalNamespace The ownership chain now fully describes both permissions and namespace membership, reducing redundancy. All tests pass with the new model. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,20 +34,23 @@ type NodeService interface {
|
||||
// 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
|
||||
Rels []RelInput
|
||||
Title string
|
||||
Content string
|
||||
DueDate string
|
||||
Namespace string // namespace name or ID; defaults to the user's personal namespace
|
||||
Rels []RelInput
|
||||
}
|
||||
|
||||
// UpdateInput describes changes to apply to an existing node.
|
||||
// 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.
|
||||
// Adding an assignee rel replaces the previous single target.
|
||||
// Setting Namespace transfers ownership from the current namespace to the new one.
|
||||
type UpdateInput struct {
|
||||
Title *string
|
||||
Content *string
|
||||
DueDate *string // nil = no change; pointer to "" = clear due date
|
||||
Namespace *string // nil = no change; namespace name or ID to move node into
|
||||
AddRels []RelInput
|
||||
RemoveRels []RelInput
|
||||
}
|
||||
@@ -56,6 +59,7 @@ type UpdateInput struct {
|
||||
// Tag filters (Target == "") match by rel_name prefix.
|
||||
// Edge filters (Target != "") are resolved to node IDs.
|
||||
type ListFilter struct {
|
||||
Namespace string // when non-empty, only return nodes owned by this namespace
|
||||
Rels []RelInput
|
||||
HasDueDate bool // when true, only return nodes that have a due date set
|
||||
DueWithin *int // when non-nil, only return nodes due within this many days (includes overdue)
|
||||
|
||||
Reference in New Issue
Block a user