Add copy functions

parent a10256c1
...@@ -34,6 +34,9 @@ module.exports = function (Contest) { ...@@ -34,6 +34,9 @@ module.exports = function (Contest) {
}, },
updateContestMeta : function (contestId, meta) { updateContestMeta : function (contestId, meta) {
return dbUtils.dbFindOneAndUpdate(Contest, {_id: contestId}, {meta : meta}); return dbUtils.dbFindOneAndUpdate(Contest, {_id: contestId}, {meta : meta});
} },
copyСontest: function (contestId) {
return dbUtils.dbDuplicateAndUpdate(Contest, {_id : contestId}, {})
}
}; };
}; };
...@@ -49,7 +49,10 @@ module.exports = function (Course) { ...@@ -49,7 +49,10 @@ module.exports = function (Course) {
}, },
updateCourseMeta : function (courseId, meta) { updateCourseMeta : function (courseId, meta) {
return dbUtils.dbFindOneAndUpdate(Course, {_id: courseId}, {meta : meta}); return dbUtils.dbFindOneAndUpdate(Course, {_id: courseId}, {meta : meta});
} },
copyCourse: function (courseId) {
return dbUtils.dbDuplicateAndUpdate(Course, {_id : courseId}, {})
}
}; };
}; };
...@@ -34,6 +34,9 @@ module.exports = function (Task) { ...@@ -34,6 +34,9 @@ module.exports = function (Task) {
}, },
getTaskForTestingTask : function (testingTaskId) { getTaskForTestingTask : function (testingTaskId) {
return dbUtils.dbFindOne(Task, { 'meta.testingTask' : testingTaskId}); return dbUtils.dbFindOne(Task, { 'meta.testingTask' : testingTaskId});
} },
copyTask: function (taskId) {
return dbUtils.dbDuplicateAndUpdate(Task, {_id : taskId}, {})
}
}; };
}; };
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