diff --git a/lib/Student.js b/lib/Student.js index 83b75d6..30611cd 100644 --- a/lib/Student.js +++ b/lib/Student.js @@ -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,