Move to new db utils

parent ca746551
......@@ -15,7 +15,7 @@ module.exports = function (Contest) {
return dbUtils.dbFindOne(Contest, {_id: contestId}, [{ path: 'course' }]);
},
getContestsByCourse : function (courseId) {
return dbUtils.dbFind(Contest, {course: courseId}, [{ path: 'course' }]);
return dbUtils.dbFind(Contest, {course: courseId}, {population : [{ path: 'course' }]});
},
removeContestById : function (contestId) {
return dbUtils.dbRemoveItem(Contest, {_id: contestId});
......
......@@ -15,13 +15,13 @@ module.exports = function (Course) {
return dbUtils.dbFindOne(Course, {_id: courseId}, [{ path: 'owner' }]);
},
getCourseByOwner : function (owner) {
return dbUtils.dbFind(Course, {owner: owner}, [{ path: 'owner' }]);
return dbUtils.dbFind(Course, {owner: owner}, {population : [{ path: 'owner' }]});
},
removeCourseById : function (courseId) {
return dbUtils.dbRemoveItem(Course, {_id: courseId});
},
getCourses : function (skip, limit) {
return dbUtils.dbFind(Course, {}, [{ path: 'owner', select: 'name surname' }], skip, limit);
return dbUtils.dbFind(Course, {}, {population : [{ path: 'owner', select: 'name surname' }], skip : skip, limit : limit });
},
getCoursesCount : function () {
return dbUtils.dbCount(Course, {});
......
......@@ -15,7 +15,7 @@ module.exports = function (Program) {
return dbUtils.dbFindOne(Program, {_id: programId}, [{ path: 'owner' }]);
},
getProgramsByOwner : function (ownerId) {
return dbUtils.dbFind(Program, {owner: ownerId}, [{ path: 'owner' }]);
return dbUtils.dbFind(Program, {owner: ownerId}, {population:[{ path: 'owner' }]});
},
removeProgramById : function (programId) {
return dbUtils.dbRemoveItem(Program, {_id: programId});
......
......@@ -15,7 +15,7 @@ module.exports = function (Task) {
return dbUtils.dbFindOne(Task, {_id: taskId}, [{ path: 'contest' }]);
},
getTasksByContest : function (contestId) {
return dbUtils.dbFind(Task, {contest: contestId}, [{ path: 'contest' }]);
return dbUtils.dbFind(Task, {contest: contestId}, {population:[{ path: 'contest' }]});
},
removeTaskById : function (taskId) {
return dbUtils.dbRemoveItem(Task, {_id: taskId});
......
......@@ -15,7 +15,7 @@
"db"
],
"dependencies": {
"db-utils": "git+https://git.niisi.ru/mirera/db-utils.git#d3382109f110df229fd27a6ab8e6fc073f349504"
"db-utils": "git+https://git.niisi.ru/mirera/db-utils.git#4bb06dea1c3464c05507c6412169b3409ecde57f"
},
"author": "Danila Eremin",
"license": "MIT"
......
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