Skip to content

Commit

Permalink
add sport name to image doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelkausari committed Mar 3, 2018
1 parent 04d8c1b commit 56e49d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion models/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const mongoose = require('mongoose');

const ImageSchema = new mongoose.Schema({
fileName: String,
playerName: String
playerName: String,
sport: String
},{
timestamps: { createdAt: '_created', updatedAt: '_updated' },
versionKey: false
Expand Down
3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ app.get('/file', (req, res) => {
app.get('/saveImage', (req, res) => {
let image = new Image ({
fileName: req.query.fileName,
playerName: req.query.playerName
playerName: req.query.playerName,
sport: req.query.sport
})
image.save(err => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class App extends Component {
let fileName = file[file.length - 1];
let playerName = this.state.term;

fetch(`${apiUrl}saveImage?fileName=${fileName}&playerName=${playerName}`)
fetch(`${apiUrl}saveImage?fileName=${fileName}&playerName=${playerName}&sport=${this.props.sport.toLowerCase()}`)
.then(res => res.json());
}

Expand Down

0 comments on commit 56e49d4

Please sign in to comment.