mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 19:59:27 +00:00
79 lines
904 B
JavaScript
79 lines
904 B
JavaScript
'use strict';
|
|
|
|
const DatabaseConnectionPool = require('./DatabaseConnectionPool');
|
|
|
|
class User {
|
|
id;
|
|
firstName;
|
|
otherNames;
|
|
lastName;
|
|
email;
|
|
#password;
|
|
type = null;
|
|
|
|
constructor(type, userId) {
|
|
const sql = `
|
|
select
|
|
email,
|
|
firstName,
|
|
otherNames,
|
|
lastName,
|
|
password,
|
|
accountId as id
|
|
from ${type}
|
|
where
|
|
${type}Id = ?;
|
|
`;
|
|
|
|
this.type = type;
|
|
|
|
return (async () => {
|
|
const conn = await new DatabaseConnectionPool();
|
|
const record = await conn.runQuery(sql, [ userId ]);
|
|
|
|
for (const [ k, v ] of Object.entries(record[0]))
|
|
this[k] = v;
|
|
|
|
return this;
|
|
})();
|
|
}
|
|
|
|
get fullName() {
|
|
|
|
}
|
|
|
|
verifyPassword(hash) {
|
|
|
|
}
|
|
|
|
changePassword(password) {
|
|
|
|
}
|
|
|
|
getPasswordReset() {
|
|
|
|
}
|
|
|
|
generatePasswordReset() {
|
|
|
|
}
|
|
|
|
login() {
|
|
|
|
}
|
|
|
|
static hashPassword(password) {
|
|
|
|
}
|
|
|
|
static createUser() {
|
|
|
|
}
|
|
|
|
static getUserByEmail() {
|
|
|
|
}
|
|
}
|
|
|
|
module.exports = User;
|