Skip to content

Data Schema

Justin Levett-Yeats edited this page Mar 15, 2017 · 31 revisions

Data Schema for Pot Lucky

Organization

The app Pot Lucky uses for its persistence layer the database platform Firebase. As Firebase uses JSON to hold data, this requires a JSON structured approach to the data schema. While this JSON object is in reality a one object with a collection of nested child objects for the purposes of this Wiki the child components will be shown separately, organized by functional area.

An important thing to note is that Firebase uses nested objects associated by keys rather than arrays for its structure. This is to ensure data can be accessed by query strings constructed object keys. i.e. databaseURL/userDetails/userId

Users

// user meta data associated the with Firebase users by userId
"userDetails": {
    "userId": {
        "firstName": "Bilbo",
        "lastName": "Baggins"
    }
},

Pot Lucks

// potLucks - origin of potLuckId and pot luck info
"potLucks": {
    "potLuckId": {
        "userId": true,
        "name": "Pot Luck 1",
        "theme": "The theme for our pot luck is Star Wars",
        "date": "2017-03-31",
        "arriveTime": "15:00",
        "serveTime": "15:30",
        "location": "At my house, some address"
    }
},

// food for potLucks - one-to-one on potLuckId, FK on courseId, FK on usersIds
"potLuckFood": {
    "potLuckId": {
        "courseId": {
            "mealId1": {
                "userId1": true,
                "meal": "mealName1"
            },
            "mealId2": {
                "userId5": true,
                "meal": "mealName2"
            },
            "mealId3": {
                // may need empty keys in here for scaffolding
            }
        }
    }
},

// initial object of invited guest emails - one-to-one on potLuckId
"potLuckInvites": {
    "potLuckId":{
        "guest1": "emailAddress1",
        "guest2": "emailAddress2",
        "guest3": "emailAddress3"
    }
},

// confirmed guests for potLuck - one-to-one on potLuckId, FK on usersIds
"potLuckGuests": {
    "potLuckId": {
        "userId1": {
            "inviteIssued": true,
            "inviteIssueDate": "2017-03-10",
            "inviteAccepted": false,
            "inviteAcceptedDate": null,
            "inviteCancelled": null,
            "inviteCancelledDate": null
        },
        "userId2": {
            "inviteIssued": true,
            "inviteIssueDate": "2017-03-10",
            "inviteAccepted": true,
            "inviteAcceptedDate": "2017-03-15",
            "inviteCancelled": null,
            "inviteCancelledDate": null
        }
    }
},

User Pot Luck list

// for getting a list of pot lucks for each user - initial scene of user pot lucks
"userPotLucks":{
    "userId1": {
        "potLuckId1": true,
        "potLuckId2": true,
        "potLuckId3": true
    },
    "userId2": {
      "potLuckId1": true
    }
},

Pot Luck course names, i.e. Salad

"courses": {
    "courseID": {
      "courseName": "courseName"
    }
}

Git Flow Procedures

Project Infos

Clone this wiki locally