-
Notifications
You must be signed in to change notification settings - Fork 6
Module reference
Kunal Nagpal edited this page Jan 25, 2016
·
7 revisions
| Sno | Directory | Remarks |
|---|---|---|
| 1 | bin | Holds the www application initiation script. |
| 2 | db | A collection of database operation modules. |
| 3 | public | Static assets. |
| 4 | routes | A collection of request handlers. |
| 5 | views | Front end layouts. |
| 6 | worker | Simulation related tasks. |
| 7 | .bowerrc | Specifies bower asset installation directory. (Deprecated) |
| 8 | gitattibutes | Specifies file handling protocols. |
| 9 | .gitignore | Specifies sensitive files to be excluded from the version control index. |
| 10 | app.js | Application bootstrapper, and middleware loader. |
| 11 | bower.json | Specifies front end dependencies. (Deprecated) |
| 12 | LICENSE | Self explanatory. |
| 13 | newrelic.js | Configuration file for the newrelic monitoring add-on. |
| 14 | package.json | Specifies application metadata. |
| 15 | Procfile | Specifies application startup command. |
| 16 | README.md | Brief setup instructions. |
| 17 | schedule.js | All in one match schedule generator. To be moved to utilities. |
Directing focus to db, we observe:
| Sno | Module | Remarks |
|---|---|---|
| 1 | features | Helper modules for team data. |
| 2 | passport | Social authentication code. |
| 3 | record | Holds the team object structure. |
| 4 | team | Team data and associated tasks. |
| 5 | users | User authentication and associated methods. |
db/mongo-features.js
| Sno | Method | Remarks |
|---|---|---|
| 1 | getStats | Fetches overall game statistics (overall runs scored, et cetera). |
| 2 | notify | Fetches feature request details. |
| 3 | simulate | Runs simulation tasks (currently dormant). |
| 4 | forgotCount | Fetches / updates the count of forgot password / user tasks. |
| 5 | warnEmptyTeams | Sends an email to the owners of empty squads / teams. |
| 6 | match | Given a match day and a team name, fetches either the opponent team or the match details. |
| 7 | fetchPlayers | Fetches data to be passed to the player selection view. |
| 8 | getPlayer | Fetches details for one particular player. Subordinate to fetchPlayers. |
| 9 | adminStats | Fetches database details. |
db/mongo-team.js
| Sno | Method | Remarks |
|---|---|---|
| 1 | getTeam | Fetches the team of 16 players. |
| 2 | getSquad | Fetches the current playing eleven. |
| 3 | dashboard | Fetches dashboard data. |
| 4 | map | Given a team name, finds the team number. |
| 5 | shortList | User authentication and associated methods. |
| 6 | adminInfo | Fetches administrative statistics. |
| 7 | fetchMatches | Fetches matchday data for the current round, for all seven days. |
| 8 | check | Internal API to check whether a selected username has been taken or not. |
| 9 | opponent | Given a team number and a matchday, finds the opponent data for that pair. |
| 10 | squad | Fetches individual player stats for a given team. |
db/mongo-users.js
| Sno | Method | Remarks |
|---|---|---|
| 1 | getCount | Calculates number of objects in the specified collection /current match collection. |
| 2 | insert | Creates a new user. |
| 3 | getLeader | Fetches leaderboard data, and marks the present team, if existing. |
| 4 | forgotPassword | Generates a time-bound password reset link. |
| 5 | forgotUser | Fetches team name details and emails the wrapped data to the user. |
| 6 | getReset | Validates the password reset token for a given request. |
| 7 | resetPassword | Resets the user password and sends confirmation email. |
| 8 | updateUserTeam | Creates a team of players from the given selection. |
| 9 | updateUserSquad | Updates the playing eleven, only valid when the 16 player team has been chosen. |
| 10 | fetchUser | Multi-purpose method used to login users or check if a user exists. |
General
First steps
Setup instructions
Technical information
Developer guidelines
Simulation