-
Notifications
You must be signed in to change notification settings - Fork 0
Data Model
connercowling edited this page Apr 13, 2015
·
9 revisions
Branchr uses a MongDB database. The following defines what the collections within that database look like, and what a document from each collection looks like.
The document schema's below are not to be confused with the REST API definition. They define the what and how of the Branchr database, not what is returned to the client by the server through the use of the API.
[TODO] Define how configure
code provided by a developer (along with the content-engine code) interfaces with the inputs
data provided by a contributor.
An example of a mongo document from users
collection
{
"_id": <mongodb-user-id>,
"username" : <user-chosen-string>,
"fname" : <user-provided-first-name>,
"lname" : <user-provided-last-name>,
"role" : <'explorer'-or-'contributor'-or-'developer'>,
"image" : <uri-to-profile-image>,
"joined" : <when-account-created>,
"bio" : <user-provided-text>
}
An example of mongo document from activities
collection
[
{
"_id": <mongodb-activity-id>,
"type" : <'like'-or-'contribute'-or-'develop'>,
"content_engine" : <content-engine-id>,
"contribution" : <contribution-id>,
"when" : <when-activity-logged>,
},
...
{
"_id": <mongodb-activity-id>,
"type" : <'like'-or-'contribute'-or-'develop'>,
"content_engine" : <content-engine-id>,
"contribution" : <contribution-id>,
"when" : <when-activity-logged>,
}
]
A example of mongo document from content-engines
collection
{
"_id" : <mongodb-content-engine-id>,
""
"developer" : <mongodb-user-id>,
"parent" : <mongodb-content-engine-id>,
"title" : <developer-provided-string>,
"initialized" : <date-time-of-creation>,
"launched" : <date-time-of-launch>,
"likes" : [
<user-id-1>,
...
<user-id-n>
],
"contributions" : [
<mongodb-contribution-id-1>,
...
<mongodb-contribution-id-n>
],
"sources" : [
<developer-provided-string-1>,
...
<developer-provided-string-2>
],
"tags" : [
<tag-1>,
...
<tag-n>
],
"code" : {
"configure" : <developer-provided-code>,
"html" : <developer-provided-code>,
"css" : <developer-provided-code>,
"javascript" : <developer-provided-code>
},
"inputs" : [
{
"type" : <type-identifier>,
"name" : <developer-provided-name>,
},
...
{
"type" : <type-identifier>,
"name" : <developer-provided-name>,
}
]
}
{
"_id" : <mongodb-contribution-id>,
"contributor" : <mongodb-user-id>,
"title" : <contributor-provided-string>,
"initialized" : <date-time-of-creation>,
"launched" : <date-time-of-launch>,
"content-engine" : <mongodb-content-engine-id>,
"likes" : [
<user-id-1>,
...
<user-id-n>
],
"sources" : [
<contributor-provided-string-1>,
...
<contributor-provided-string-2>
],
"inputs" : [
{
"type" : <type-identifier>,
"name" : <developer-provided-name>,
"value" : <contributor-provided-value>
},
...
{
"type" : <type-identifier>,
"name" : <developer-provided-name>,
"value" : <contributor-provided-value>
}
]
}