pub struct Services<'a, St> {
pub store: &'a St,
pub links: &'a dyn LinkRepository,
pub collections: &'a dyn CollectionRepository,
pub query: &'a dyn QueryEngine,
pub clock: &'a dyn Clock,
pub ids: &'a dyn IdGenerator,
pub blobs: &'a dyn BlobStore,
}Fields§
§store: &'a St§links: &'a dyn LinkRepository§collections: &'a dyn CollectionRepository§query: &'a dyn QueryEngine§clock: &'a dyn Clock§ids: &'a dyn IdGenerator§blobs: &'a dyn BlobStoreImplementations§
Source§impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
Source§impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
Sourcepub async fn import_superproductivity(
&self,
json: &str,
) -> Result<Vec<TaskSnapshot>, Error>
pub async fn import_superproductivity( &self, json: &str, ) -> Result<Vec<TaskSnapshot>, Error>
Import a Super Productivity JSON backup. Returns the created project root tasks (one per SP project, per user decision — not a tag).
Source§impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
Sourcepub async fn export(&self, root: &Id) -> Result<Export, Error>
pub async fn export(&self, root: &Id) -> Result<Export, Error>
Collect root + its descendant subtree (tasks and the edges among them).
pub async fn export_json(&self, root: &Id) -> Result<String, Error>
Sourcepub async fn import_json(&self, json: &str) -> Result<(), Error>
pub async fn import_json(&self, json: &str) -> Result<(), Error>
FR-17: ingest an Export (round-trips with Self::export).
Source§impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
Source§impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
Sourcepub async fn resolve_id(&self, typed: &str) -> Result<Id, Error>
pub async fn resolve_id(&self, typed: &str) -> Result<Id, Error>
Resolve a user-typed id or short prefix (git/jj-style abbreviation,
spec-independent — see todoapp_core::resolve_id_prefix) against every
id currently in the store. The CLI/TUI entry point for letting a human
type a short id instead of the full ULID.
Sourcepub async fn snapshot(&self, id: &Id) -> Result<TaskSnapshot, Error>
pub async fn snapshot(&self, id: &Id) -> Result<TaskSnapshot, Error>
Assemble a read-only TaskSnapshot from the task’s components.
Sourcepub async fn children_of(&self, parent: &Id) -> Vec<Link>
pub async fn children_of(&self, parent: &Id) -> Vec<Link>
Child links out of parent, ordered by position.
Sourcepub async fn parent_of(&self, child: &Id) -> Option<Id>
pub async fn parent_of(&self, child: &Id) -> Option<Id>
The structural parent of child, if any (single-parent tree). The
virtual-root sentinel maps to None — a root has no visible parent.
Sourcepub async fn roots(&self) -> Vec<Id>
pub async fn roots(&self) -> Vec<Id>
Top-level tasks: the invisible root’s children, ordered by position
(spec §7). Port-level via outgoing(ROOT, Child) — indexed in Turso,
no whole-store scan.
Sourcepub async fn is_blocked(&self, id: &Id) -> bool
pub async fn is_blocked(&self, id: &Id) -> bool
Derived blocked (spec §8): some incoming blocks edge whose blocker
task is not done.
Sourcepub async fn descendants(&self, id: &Id) -> HashSet<Id>
pub async fn descendants(&self, id: &Id) -> HashSet<Id>
All descendants of id via child links (excludes id).
Source§impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
impl<'a, St: ComponentStore + TaskEntityStore> Services<'a, St>
Sourcepub async fn create(
&self,
title: impl Into<String>,
parent: Option<&Id>,
status: Status,
tags: impl IntoIterator<Item = String>,
) -> Result<TaskSnapshot, Error>
pub async fn create( &self, title: impl Into<String>, parent: Option<&Id>, status: Status, tags: impl IntoIterator<Item = String>, ) -> Result<TaskSnapshot, Error>
FR-1/FR-2: create one task, optionally under parent (appended last).
Sourcepub async fn batch_create(&self, text: &str) -> Result<Vec<TaskSnapshot>, Error>
pub async fn batch_create(&self, text: &str) -> Result<Vec<TaskSnapshot>, Error>
FR-1: batch-create from text, indentation (2 spaces or a tab) = depth (spec §13 Q7 default). Returns tasks in document order.
pub async fn set_title( &self, id: &Id, title: impl Into<String>, ) -> Result<TaskSnapshot, Error>
pub async fn set_notes( &self, id: &Id, notes: Option<String>, ) -> Result<TaskSnapshot, Error>
pub async fn set_status( &self, id: &Id, status: Status, ) -> Result<TaskSnapshot, Error>
pub async fn set_due( &self, id: &Id, due: Option<Due>, ) -> Result<TaskSnapshot, Error>
pub async fn set_estimate( &self, id: &Id, estimate: Option<Duration>, ) -> Result<TaskSnapshot, Error>
pub async fn add_time_spent( &self, id: &Id, spent: Duration, ) -> Result<TaskSnapshot, Error>
pub async fn add_tag( &self, id: &Id, tag: impl Into<String>, ) -> Result<TaskSnapshot, Error>
pub async fn remove_tag( &self, id: &Id, tag: impl Into<String>, ) -> Result<TaskSnapshot, Error>
pub async fn assign(&self, id: &Id, actor: Id) -> Result<TaskSnapshot, Error>
pub async fn unassign(&self, id: &Id, actor: Id) -> Result<TaskSnapshot, Error>
Sourcepub async fn claim(&self, id: &Id, actor: Id) -> Result<TaskSnapshot, Error>
pub async fn claim(&self, id: &Id, actor: Id) -> Result<TaskSnapshot, Error>
FR-11: claim a todo task (open if unassigned, else assignee-only).
Sourcepub async fn set_recurrence(
&self,
id: &Id,
recurrence: Option<Recurrence>,
) -> Result<TaskSnapshot, Error>
pub async fn set_recurrence( &self, id: &Id, recurrence: Option<Recurrence>, ) -> Result<TaskSnapshot, Error>
A recurring task resets in place on completion instead of staying
done (see Event::StatusSet(Status::Done)’s apply arm).
pub async fn set_issue_ref( &self, id: &Id, issue_ref: Option<IssueRef>, ) -> Result<TaskSnapshot, Error>
pub async fn set_time_log( &self, id: &Id, time_log: BTreeMap<Date, Duration>, ) -> Result<TaskSnapshot, Error>
pub async fn set_archived( &self, id: &Id, archived: bool, ) -> Result<TaskSnapshot, Error>
Sourcepub async fn add_attachment_from_bytes(
&self,
id: &Id,
title: impl Into<String>,
bytes: Vec<u8>,
mime: Option<String>,
) -> Result<TaskSnapshot, Error>
pub async fn add_attachment_from_bytes( &self, id: &Id, title: impl Into<String>, bytes: Vec<u8>, mime: Option<String>, ) -> Result<TaskSnapshot, Error>
Attach a file’s actual bytes (stored via BlobStore) to a task.
Sourcepub async fn add_attachment_link(
&self,
id: &Id,
title: impl Into<String>,
url: impl Into<String>,
) -> Result<TaskSnapshot, Error>
pub async fn add_attachment_link( &self, id: &Id, title: impl Into<String>, url: impl Into<String>, ) -> Result<TaskSnapshot, Error>
Attach a bare link (no stored bytes) to a task.
pub async fn remove_attachment( &self, id: &Id, attachment_id: Id, ) -> Result<TaskSnapshot, Error>
Sourcepub async fn move_task(
&self,
id: &Id,
parent: &Id,
anchor: Option<Anchor>,
) -> Result<(), Error>
pub async fn move_task( &self, id: &Id, parent: &Id, anchor: Option<Anchor>, ) -> Result<(), Error>
Re-point id’s single child parent to parent at anchor (FR-8).
Rejects a move under the task’s own subtree (cycle).