It's time we started thinking about what our application state will look like. Our entities in this application are the card, which represents a task and has the attributes id, name, and description, and the column. To keep things simple, we will work with only three columns: Backlog, In Progress, and Done:
(def init-data
{:card/by-id {1 {:db/id 1 :card/name "Expenses" :card/description "Submit last client's expense report"}
2 {:db/id 2 :card/name "Groceries shopping" :card/description "Almond milk, mixed nuts, eggs..."}}
:column/list [[:column/by-id 1]
[:column/by-id 2]
[:column/by-id 3]]
:column/by-id {1 {:db/id 1
:column/title "Backlog"
:column/cards [[:card/by-id 1] [:card/by-id 2]]}
2 {:db/id 2
:column/title "In Progress"
:column/cards []}
3 {:db/id 3
:column/title "Done"
:column/cards []}}})
We have two interesting keys—:card/by-id and :column/by-id. The first one is a hash with cards, together with their details, keyed by IDs. The second one contains the details about our columns. We should notice that the Backlog column has a :colums/cards key that references the currently assigned cards. The :column/list key contains IDs of columns. By keying cards and columns by id, we can reference them easily in our application state. This provides normalization to our data and, as we will see, helps to retrieve data in Om.