Nested tasks
To make our simple task list app a little more interesting, we'll add the ability to nest tasks. In other words, we'll allow some tasks to be subtasks of other tasks. Doing so requires only a slight change to our model, for example adding a ParentId
property:
public class Task { public string Description { get; set; } public bool IsComplete { get; set; } public string ParentId { get; set; } public bool Type { get { return "task"; } } }
There are numerous ways to set up a user interface to allow parent tasks to be set. In the interest of brevity, we'll assume that our create
and edit
actions and views have two simple additions:
#get all tasks returned by the #all_incomplete view in the tasks design document tasks = client.query("tasks", ...
Get Couchbase Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.