AuburnBigEvent / BigEvent

Auburn University SGA Big Event application designed for COMP 4710 senior design project.
MIT License
0 stars 2 forks source link

Integrates database schema changes, should fix everything current implemented #21

Closed CoryG89 closed 10 years ago

CoryG89 commented 10 years ago

This commit attempts to make only minimal changes in order to make the current code base work with the database changes. Only very minimal changes were needed in order to get the staff home page to work the same way with the new schema. There was lots of other refactoring that could be done, but the purpose of this pull request is only to get what we already have working and not to try to improve things at same time. Now that it is working, we can go back and do any refactoring if needed.

CoryG89 commented 10 years ago

I fixed all the problems that I could find. A little more information about the new db schema. Basically we only have 4 collections as of now:

All user documents have 3 top-level string fields: _id, email, and role.

The different roles we currently have:

When a user signs in for the first time there role is user until they register as a volunteer, become a project coordinator, etc. My user document after signing in for the first time and before registering as a volunteer:

{
    "_id": "472dfb3ecf6f2b05",
    "email": "cmg0030@tigermail.auburn.edu",
    "role": "user"
}

When they're role changes a subdocument field is added to the user document with the same name as their role. So here is an example of my user document:

{
    "_id": "472dfb3ecf6f2b05",
    "email": "cmg0030@tigermail.auburn.edu",
    "role": "volunteer",
    "volunteer": {
        "firstName": "Cory",
        "lastName": "Gross",
        "gender": "Male",
        "address": "501 Webster Rd.",
        "city": "Auburn",
        "state": "AL",
        "zip": "36832",
        "phone": "256-613-7428",
        "shirtSize": "S",
        "team": "a7ccc7eb-a722-4cd4-b317-f719ecb9401d",
        "location": {
            "lat": 32.5902257,
            "lng": -85.522278
        },
        "formattedAddress": "501 Webster Road, Auburn, AL 36832, USA"
    }
} 

Any data that is gathered beyond the _id, the email and the role should be placed in a subdocument field specific to the role. This allows us to maintain a consistent structure across all user documents with different roles.

For a project coordinator it would look like:

{
    "_id": "472dfb3ecf6f2b05",
    "email": "cmg0030@tigermail.auburn.edu",
    "role": "coordinator",
    "coordinator": {
        "firstName": "Cory",
        "lastName": "Gross",
        "gender": "Male",
        "address": "501 Webster Rd.",
        "city": "Auburn",
        "state": "AL",
        "zip": "36832",
        "phone": "256-613-7428",
        "shirtSize": "S",
        "location": {
            "lat": 32.5902257,
            "lng": -85.522278
        },
        "formattedAddress": "501 Webster Road, Auburn, AL 36832, USA"
    }
} 

The fields within the coordinator subdocuments in coordinator user documents may differ from the volunteer subdocuments in volunteer user documents (note that project coordinators won't have a team field because they cannot join volunteer teams), but all user documents should have the 3 base fields _id, email, and role.

CoryG89 commented 10 years ago

I have been testing this all day and I think I have found and fixed all the problems. I am going to go ahead and merge this into the main repository so you can pull from upstream when you're ready and so I can merge this into my master branch and start exploring the design on the jobsite evaluation form.