Fix accounts model
This commit is contained in:
@@ -1,18 +1,14 @@
|
||||
const db = require('../../data/dbConfig');
|
||||
|
||||
module.exports = {
|
||||
addUser
|
||||
addUser,
|
||||
};
|
||||
|
||||
function addUser(userData) {
|
||||
db.one('INSERT INTO account VALUES("", ${username}, ${email}, ${password}, ${timezone}, ${earliest_time}, ${latest_time}) RETURNING *', userData)
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
return data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('ERROR:', error);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// TODO Complete query without providing id
|
||||
// right now if ID is not provided, pg-promise send an erro fo mising column
|
||||
return db.one(
|
||||
'INSERT INTO account VALUES(emptyUpdate, ${username}, ${email}, ${password}, ${timezone}, ${earliest_time}, ${latest_time}) RETURNING *',
|
||||
userData,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user