2020-05-01 15:32:46 +00:00
|
|
|
const db = require('../../data/dbConfig');
|
|
|
|
|
|
|
|
module.exports = {
|
2020-05-01 16:24:59 +00:00
|
|
|
addUser,
|
2020-05-01 15:32:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
function addUser(userData) {
|
2020-05-01 16:24:59 +00:00
|
|
|
// 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,
|
|
|
|
);
|
|
|
|
}
|