updateContest and removeContestLogo functions

parent 4fd9b49c
......@@ -11,6 +11,9 @@ module.exports = function (Contest) {
addContest : function(courseId, name, info, description, start, finish, meta) {
return dbUtils.dbCreateItem(Contest,{ course: courseId, name: name, info: info, description: description, start : start, finish : finish, meta : meta});
},
updateContest : function(contestId, name, info, description, start, finish) {
return dbUtils.dbFindOneAndUpdate(Contest,{_id : contestId},{ name: name, info: info, description: description, start : start, finish : finish});
},
getContestById : function (contestId) {
return dbUtils.dbFindOne(Contest, {_id: contestId}, [{ path: 'course' }]);
},
......
......@@ -12,6 +12,9 @@ module.exports = function (gfs) {
getCourseLogo : function(courseId) {
return dbUtils.readFileToBuffer(gfs, courseId.toString() + '/logo.png' );
},
removeContestLogo : function(contestId) {
return dbUtils.removeFile(gfs, contestId.toString() + '/logo.png' );
},
saveContestLogo : function(path, contestId) {
return dbUtils.copyFileToGridFS(gfs, path, contestId.toString() + '/logo.png' );
},
......
......@@ -30,17 +30,17 @@ var ContestSchema = new mongoose.Schema({
created: {
type: Date,
default: Date.now,
required: true,
required: true
},
start: {
type: Date,
default: Date.now,
required: true,
required: true
},
finish: {
type: Date,
default: Date.now,
required: true,
required: true
},
meta: {
type: {},
......
......@@ -30,7 +30,7 @@ var CourseSchema = new mongoose.Schema({
created: {
type: Date,
default: Date.now,
required: true,
required: true
}
});
......
......@@ -17,7 +17,7 @@ var ProgramSchema = new mongoose.Schema({
testProgramId : {
type: mongoose.Schema.Types.ObjectId,
required: true
},
}
});
module.exports = ProgramSchema;
\ No newline at end of file
......@@ -35,7 +35,7 @@ var TaskSchema = new mongoose.Schema({
created: {
type: Date,
default: Date.now,
required: true,
required: true
},
meta: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment