generated from the-collab-lab/smart-shopping-list-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 1
Data Structure
Scott Bergler edited this page Apr 15, 2020
·
5 revisions
This wiki is about trying to decide on what our data shapes should be and to think about how to enact them in Firebase.
Sara and I, based on Steve's comments on it, see these two possibilities:
This is a collection of items. Each item has a field that is the token of the user who saved it to their list.
[
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object",
"user_token": "ahsdfihwaefwe"
},
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object",
"user_token": "ahsdfihwaefwe"
},
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object",
"user_token": "ahsdfihwaefwe"
},
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object",
"user_token": "ahsdfihwaefwe"
}
]
This is a collection of users, each with a collection of items.
[
"user_token": [
{
"name": "blah",
"next_purchase": 7,
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": 30,
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": 14,
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": 7,
"last_purchase": "some date string/object"
}
],
"user_token": [
{
"name": "blah",
"next_purchase": 7,
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": 30,
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": 14,
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": 7,
"last_purchase": "some date string/object"
}
]
]
This is a collection of Users. Each User has a token field and a sub-collection, shopping_list, which is a collection of items.
{
"users": [
{
"user": "ahsdfihwaefwe",
"shopping_list": []
},
{
"user": "ahsdfihwaefwe",
"shopping_list": [
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object"
},
{
"name": "blah",
"next_purchase": "soon",
"last_purchase": "some date string/object"
}
]
}
]
}
Some relevant links: Firebase data model