1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 20:59:30 +00:00

Add Student.getParents

This commit is contained in:
2022-04-23 21:56:32 +00:00
parent 9c6f38ee0e
commit 87d20a7926

View File

@@ -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) { static async createStudent(conn, fname, oname, lname, email, password) {
return await super.createUser( return await super.createUser(
conn, conn,