Rewrite what libimagtodo should implement

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-06-15 17:02:42 +02:00
parent adca7a4a1c
commit 21cc901d06

View file

@ -3,42 +3,43 @@
The library for the todo module which provides functionality to The library for the todo module which provides functionality to
implement/implements a todomanager in imag. implement/implements a todomanager in imag.
### Implementation details ### Implementation details
One todo entry is stored as one imag entry. The ID of the imag entry is generated by One todo entry is stored as one imag entry. The ID of the imag entry is
appending a unique ID (UUID) to "todo/". generated by appending a unique ID (UUID) to "todo/".
The unique ID identifies the todo entry. The unique ID identifies the todo entry.
#### Stored data #### Stored data
A todo entry stores the following information: A todo entry stores the following information:
* The (UU)ID of the todo entry * The (UU)ID of the todo entry
* A status of the todo entry. Valid values are: "deleted", "done", "pending" * A status of the todo entry. Valid values are: "deleted", "done", "pending"
* A "scheduled" date/datetime, can also yield an iterator * An optional "scheduled" date/datetime
* An optional "hidden" value, which specifies a date in the future where this * An optional "hidden" value, which specifies a date in the future where this
todo entry should show up. Relative (eg. "-5days"), todo entry should show up.
to the "scheduled" date/datetime * An optional "due" date/datetime
* An optional "due" date/datetime, relative to the "scheduled" time * A "priority"-level, either "h", "m", "l"
* A list of dependencies of the entry
* A "importance"-level, config file defined (strings in an array, index used for
ranking them)
* User defined value (a map of key-value string pairs)
The description of the todo entry is stored as plain text. The description of the todo entry is stored as plain text.
#### Data not stored #### Data not stored
Some data is explicitely _not_ stored by the library because there are other Some data is explicitely _not_ stored by the library because there are other
libraries fullfilling that purpose. These are: libraries fullfilling that purpose. These are:
* Related todos, which can be done via libimagentrylink
* Tags, which can be done with libimagentrytag * Tags, which can be done with libimagentrytag
* Category, which can be done with libimagentrycategory * Category, which can be done with libimagentrycategory
* Project belonging, which can be done with libimagentrylink (by linking to a * Project belonging, which can be done with libimagentrylink (by linking to a
project file - note that "project" is a domain not yet implemented by imag) project file - note that "project" is a domain not yet implemented by imag)
* Annotations, which can be stored with libimagentryannotation * Annotations, which can be stored with libimagentryannotation
#### Header format #### Header format
The header partial for libimagtodo is as follows: The header partial for libimagtodo is as follows:
@ -46,42 +47,24 @@ The header partial for libimagtodo is as follows:
``` ```
[todo] [todo]
uuid = "string" uuid = "string"
status = "string" status = "enum { 'deleted', 'done', 'pending' }"
scheduled = "<kairos time spec>" scheduled = "<NaiveDateTime>" // optional
hidden = "<kairos time func (optional)>" hidden = "<NaiveDateTime>" // optional
due = "<kairos time func (optional)>" due = "<NaiveDateTime>" // optional
depends = [ "list of uuids" ] priority = "enum { 'h', 'm', 'l' }" // optional
importance = "string"
uda = {}
``` ```
#### Functionality #### Functionality
The provided functionality of this library includes, but is not limited to: The provided functionality of this library includes, but is not limited to:
* Creating new todo entries in the store * Creating
* Deleting todo entries from the store * Deleting
* get/retrieving todo entries from the store * Get/Retrieving
* Turning an entry into a todo entry * Getting data about the todo
* Getting todo details from an entry * Reading metadata: scheduled, due, waiting, prio, uuid, status,...
* scheduled, due, waiting date/datetime * Related (via libimagentrylink) todo entries
* priority
* UUID
* status
* An iterator over all dependend todo entries (as `StoreIdIterator`)
* Calculating a "urgency" of a todo entry from a formula weighted by configurable factors
#### Dependencies between tasks
Dependencies between todo entries are created by putting the UUID of a dependent todo entry into
the `todo.depends` header.
This way, a unidirectional link is created. A link (as in `libimagentrylink`) is
_also_ created, but this can be turned off explicitely.
As `libimagentrylink` links are bidirectional, they do not suffice for todo
entry dependency creation.
As todo entries are stored with the Store IDs "todo/<uuid>", creating a
`StoreId` from a UUID is trivial.