mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 13:59:25 +00:00
Add Student.getParents
This commit is contained in:
@@ -30,6 +30,27 @@ class Student extends User {
|
||||
}));
|
||||
}
|
||||
|
||||
async getParents() {
|
||||
const sql = `
|
||||
select
|
||||
parentId
|
||||
from
|
||||
studentParentLink
|
||||
where
|
||||
studentId = ?;
|
||||
`;
|
||||
|
||||
return await Promise.all(
|
||||
(await this._conn.runQuery(sql, [ this.id ]))
|
||||
.map(({ parentId }) => {
|
||||
return new (require('./Parent'))(
|
||||
this._conn,
|
||||
parentId
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
static async createStudent(conn, fname, oname, lname, email, password) {
|
||||
return await super.createUser(
|
||||
conn,
|
||||
|
||||
Reference in New Issue
Block a user