You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to start using the firebase store. From now on, we will have to think about how to store the data constructs used. We should be using the realtime database. We will need to implement our own offline solution.
We need to organize data for queries, not for storage. As with any NoSQL database, denormalization is key. Please read completely through the firebase documentation before continuing.
Here is the scheme I have in mind:
NOTE: The top-level items are Collections. The *ref* items are the document references.
{states: {stateRef1: {name: 'CheckBoxes with an Intermediate State',description: 'Standard checkboxes with an intermediate state.',stateOrder: ['notDone','inProgress','done'],states: {notDone: {text: 'Not Done',value: 0,icon: 'mdi-checkbox-blank-outline',color: '#ff0000',},done: {text: 'Done',value: 1,icon: 'mdi-checkbox-marked-outline',color: '#00ff00',},inProgress: {text: 'In Progress',value: 0.5,icon: 'mdi-checkbox-intermediate',color: '#00ffff',},},},},userStatuses: {user1Ref: {listRef: {_status: 'inProgress',// cached status so we don't have to actually get the list items to calculate its status. useful for sublistslistItemRef: 'done',listItem2Ref: 'inProgress',},},},lists: {// we want to store the list options here, so we don't have to retrieve the entire list with items when we just want a sublistlist1Ref: {// firebase assigns new docs these IDs, when using push() we should take full advantage of this.title: 'Test One',color: '#ff00ff',// the color of the tile and background color of the page viewstates: 'stateref1',// we are deduplicating states byprerequisite: 'list3Ref.complete && list5Ref.listItem1Ref1 >= 5',// prerequisites for enabling this list. NO EVAL()!},list2Ref: {title: 'Test Two',color: '#ff0000',},list3Ref: {title: 'Test Three',color: '#ffff00',},list4Ref: {title: 'Test Four',color: '#465362',},},listItems: {list1Ref: {list1Item1Ref: {text: 'Item 1',// the dispalyed text of the list itemstate: 'done',// state can be any arbitrary value, i.e. "5", "ten",prerequisite: '(list item 2 title).done',// one of several ways to specify objects in ourorder: 0,},list1Item2Ref: {text: 'Item 2',state: 'inProgress',order: 1,},list1Item3Ref: {ref: 'someOtherListID',order: 2,},},list2ref: {list2Item1Ref: {text: 'Item 2',state: 'inProgress',order: 0,},list2Item2Ref: {text: 'Item 2',state: 'inProgress',order: 1,},},},}
After much information consumption, I have devised a new DB schema. Since firecloud charged based on document reads, and can't return partial documents, I have optimized for views and documents/size.
Note: there is a 1Mb document limit, so some objects may require multiple documents. We will implement that when we get there.
Collections:
globalPreferences. // Defaults and global configuration options
lists // the list objects
lists/{list.id}/listItems. //the listItems for the list. One document is an array of all the items.
stateGroups // a group of states
users. // User information
users/{user.id}/listItemStates // one document for all the states.
We need to start using the firebase store. From now on, we will have to think about how to store the data constructs used. We should be using the realtime database. We will need to implement our own offline solution.
We need to organize data for queries, not for storage. As with any NoSQL database, denormalization is key. Please read completely through the firebase documentation before continuing.
Here is the scheme I have in mind:
NOTE: The top-level items are Collections. The
*ref*
items are the document references.NOTE:
list.bgColor
is now justcolor
.You should use the firebase emulator for testing this feature. https://firebase.google.com/docs/emulator-suite
The text was updated successfully, but these errors were encountered: