added Users
This commit is contained in:
parent
531da9aee7
commit
61f95544b4
12
db/index.js
12
db/index.js
|
@ -168,6 +168,17 @@ const getAllFromTable = function(req, res, next) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getUserByEmail = function(username) {
|
||||||
|
let query = "Select id, name, email, kennwort, beschreibung FROM nutzer WHERE email ilike '"+username+"'";
|
||||||
|
if(DEBUG) console.log(query);
|
||||||
|
req.db.query(query, (err, rs) => {
|
||||||
|
if (err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return rs.rows[0];
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
query,
|
query,
|
||||||
|
@ -178,5 +189,6 @@ module.exports = {
|
||||||
insertNameKeyObject,
|
insertNameKeyObject,
|
||||||
deleteNameKeyObject,
|
deleteNameKeyObject,
|
||||||
getAllFromTable,
|
getAllFromTable,
|
||||||
|
getUserByEmail,
|
||||||
getStructure
|
getStructure
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
import { getUserByEmail } from ('./../db/');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class User {
|
||||||
|
|
||||||
|
findOne(username) {
|
||||||
|
getUserByEmail(username).then()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default User;
|
Loading…
Reference in New Issue