diff --git a/models/Image.js b/models/Image.js index b5dd649..cb483b8 100644 --- a/models/Image.js +++ b/models/Image.js @@ -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 diff --git a/server.js b/server.js index ad53614..25d36f4 100644 --- a/server.js +++ b/server.js @@ -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) { diff --git a/src/App.js b/src/App.js index 445a3ae..7048310 100644 --- a/src/App.js +++ b/src/App.js @@ -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()); }