Upload All
This commit is contained in:
26
models/mongooseSchemas/Participation.js
Normal file
26
models/mongooseSchemas/Participation.js
Normal file
@ -0,0 +1,26 @@
|
||||
const mongoose = require("mongoose");
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
let ParticipationSchema = Schema({
|
||||
nthSeason : Number,
|
||||
themeName : String,
|
||||
activityRank : Number,
|
||||
postTime : { type: Date, default: Date.now }
|
||||
});
|
||||
|
||||
ParticipationSchema.statics.createNewParticipation = function (data, callback) {
|
||||
let newParticipation = this({
|
||||
nthSeason : data.nthSeason,
|
||||
themeName : data.themeName,
|
||||
activityRank : data.activityRank,
|
||||
postTime : data.postTime
|
||||
});
|
||||
newParticipation.save((err, obj) => {
|
||||
if (err)
|
||||
callback(err, null);
|
||||
else
|
||||
callback(null, obj._id);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = mongoose.model("Participation", ParticipationSchema);
|
Reference in New Issue
Block a user