Server files
- Product Owner: Hamzah Chaudhary
- Scrum Master: Michael Cheung
- Development Team Members: Steffen Baumgarten
###Server Dependencies
- node 2.x.x or higher
- express 4.13.4
- morgan 1.7.0
- mysql 2.10.2
- sequelize 3.20.0
- body-parser 1.15.0
##Development
##Installing Dependencies
Inside of the root directory:
npm install
###Server Information
This repo contains the Back-end for the mobile application SumoChickn. It utilizes a mySQL database along with a Node/Express server to store all the data necessary for the application to run.
####Server Design
- /getInitialData/:userId GET
Request Params = {userId: integer}
Gets the initial data of all challenges associated with the specified user.
- /getAllUsers GET
Gets the information of all users in the database
- /login POST
Request Body = {username: string}
Logs the user in with their facebook account as well as save their facebook name to the database.
- /submitChallenge POST
Request Body: {challengeText: string, points: integer, createdBy: string, userChallenged: string, UserId: integer}
Sends a challenge to a specified user through the UserId property.
- /toggleChallenge/:id PUT
Request Params: {id: integer}
Toggles a challenge from incomplete to complete
- /addPhoto/:id PUT
Request Params: {id: integer}
Update the proofUrl property on the database with the url of the photo captured.
- /getPhoto/:id GET
Request Params: {id: integer}
Gets the photo from a specific challenge through the challenge id.
- /getClosedChallenges/:from/:to GET
Request Params: {from: integer, to: integer}
Gets the number of completed challenges from the database start from 'from' up to and including 'to'
- /voteOnproof/:id/:vote PUT
Request params: {id: integer, vote: integer}
Updates the yes-vote or no-vote property of the challenge. If a vote of 0 is passed, the no-vote property is incremented, otherwise if a vote of 1 is passed, the yes-vote property will increment.
####Database Design
To simplify database querying and initialization, Sequelize was used with the mySQL database. There are 4 tables in the database, the schema is as follows:
- User
- id - The user's unique id
- name - String
- beastPoints - Integer
- wussPoints - Integer
- Challenge
- id - The challenge's unique id
- challengeText - String
- points - Integer
- createdBy - String
- complete - Boolean
- expired - Boolean
- userChallenged - String
- proofUrl - String
- voteCountYes - Integer
- voteCountNo - Integer
- closedDate - Date
- Tribe
- id - The Tribe's unique id
- tribeName - The name of the tribe
- User_Tribe
- id_User - The user's id
- id_Tribe - The tribe's id
See CONTRIBUTING.md for contribution guidelines.