-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,496 additions
and
1,163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
repo_token: p6ReD172PdYitrH3pVlD8SFd2E6fstcZQ | ||
repo_token: SFXDaMFDDKpJZz3M9Z1h3GIeHkh4Lhx7f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ public/lib | |
.sass-cache/ | ||
.DS_store | ||
c4h_keys.txt | ||
bower_components | ||
/data | ||
/.env | ||
.nyc_output | ||
coverage | ||
/data | ||
/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ node_js: | |
services: | ||
- mongodb | ||
|
||
after-script: | ||
npm run coverage | ||
after_script: | ||
- npm run coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
import gameModel from '../models/game'; | ||
|
||
/** | ||
* | ||
* @param {object} req - The HTTP request | ||
* @param {object} res - The HTTP response | ||
* @returns {void} | ||
*/ | ||
const saveGame = (req, res) => { | ||
const { | ||
players, winner, gameStarter, roundsPlayed, | ||
} = req.body; | ||
const gameID = req.params.id; | ||
|
||
const gameEntry = new gameModel({ | ||
players, | ||
gameID, | ||
winner, | ||
gameStarter, | ||
roundsPlayed, | ||
}); | ||
|
||
gameEntry.save() | ||
.then((game) => { | ||
res.status('201').json({ | ||
msg: 'Success, Game saved', | ||
game | ||
}); | ||
}) | ||
.catch((error) => { | ||
res.status('400').json({ | ||
msg: 'Failure, Game not saved', | ||
error | ||
}); | ||
}); | ||
}; | ||
|
||
export default saveGame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import mongoose, { Schema } from 'mongoose'; | ||
import '../../config/config'; | ||
|
||
/** | ||
* Game Schema | ||
*/ | ||
const GameSchema = new Schema( | ||
{ | ||
players: { | ||
type: Array, | ||
required: true, | ||
}, | ||
gameID: { | ||
type: String, | ||
required: true, | ||
}, | ||
winner: { | ||
type: String, | ||
required: true, | ||
}, | ||
gameStarter: { | ||
type: String, | ||
required: true, | ||
}, | ||
roundsPlayed: { | ||
type: Number, | ||
} | ||
}, | ||
{ timestamps: { createdAt: 'playedAt' } } | ||
); | ||
|
||
export default mongoose.model('Game', GameSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.