Commit bc7a6933 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

add db methods

parent 5a58ac80
Showing with 2 additions and 29 deletions
+2 -29
...@@ -6,34 +6,6 @@ var methods = { ...@@ -6,34 +6,6 @@ var methods = {
console.log('Current Date is: ' + new Date().toISOString().slice(0, 10)); console.log('Current Date is: ' + new Date().toISOString().slice(0, 10));
}, },
// ===================== user db ===================== // ===================== user db =====================
/*
getUserByEmail: function(email, callback) {
dbconn.user.query('SELECT salutation, title, firstname, lastname, industry, organisation, speciality FROM user WHERE email = "' +email+'"', function (err, rows, fields) {
if (err) {
throw err;
}
else {
if ( rows.length > 0) {
user = rows[0];
}
}
callback(user, err);
});
},
checkUserEmail: function(email, callback) {
var user;
dbconn.user.query('SELECT id, email FROM user WHERE email = "' +email+'"', function (err, rows, fields) {
if (err) {
throw err;
}
else {
if ( rows.length > 0) {
user = rows[0];
}
}
callback(err, user);
});
},
getUserIdByEmail: function(email, callback) { getUserIdByEmail: function(email, callback) {
var userId var userId
dbconn.user.query('SELECT id FROM user WHERE email = "' +email+'"', function (err, rows, fields) { dbconn.user.query('SELECT id FROM user WHERE email = "' +email+'"', function (err, rows, fields) {
...@@ -48,19 +20,20 @@ var methods = { ...@@ -48,19 +20,20 @@ var methods = {
callback(userId, err); callback(userId, err);
}); });
}, },
/*
getUserProjectRole: function(userId, callback) { getUserProjectRole: function(userId, callback) {
dbconn.user.query('SELECT project_id, role_id FROM user_project_role WHERE user_id = "' +userId+'"', function (err, rows, fields) { dbconn.user.query('SELECT project_id, role_id FROM user_project_role WHERE user_id = "' +userId+'"', function (err, rows, fields) {
if (err) throw err; if (err) throw err;
callback(rows, err); callback(rows, err);
}); });
}, },
*/
addUserProjectRole: function(data, callback) { addUserProjectRole: function(data, callback) {
dbconn.user.query('INSERT INTO user_project_role SET ?', data, function (err, results, fields){ dbconn.user.query('INSERT INTO user_project_role SET ?', data, function (err, results, fields){
if (err) throw err; if (err) throw err;
callback(err); callback(err);
}) })
}, },
*/
// ======================= project db ======================= // ======================= project db =======================
getAllProjects: function(callback) { getAllProjects: function(callback) {
dbconn.project.query('CALL getAllprojects', function (err, rows, fields){ dbconn.project.query('CALL getAllprojects', function (err, rows, fields){
......
Supports Markdown
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