Upload All

This commit is contained in:
Alan
2018-02-26 14:09:18 +08:00
parent 42d3a3fc46
commit 46257f08b0
1024 changed files with 204324 additions and 0 deletions

View File

@ -0,0 +1,22 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
let RatingSchema = Schema({
username : String,
score : {type : Number, min: 1, max: 5}
});
RatingSchema.statics.createNewRating = function(data, callback) {
let newRating = this({
username : data.username,
score : data.score
});
newRating.save((err, rating) => {
if (err)
callback(err, null);
else
callback(null, rating);
});
}
module.exports = mongoose.model("Rating", RatingSchema);