diff --git a/lib/Class.js b/lib/Class.js index 559d329..8a9f44d 100644 --- a/lib/Class.js +++ b/lib/Class.js @@ -15,6 +15,12 @@ class Class { */ subjectId; + /** + * The subject the class is for + * @type {Subject} + */ + subject; + /** * The name of the class * @type {string} @@ -48,11 +54,16 @@ class Class { for (const [ k, v ] of Object.entries(record[0])) this[k] = v; + this.subject = await this.getSubject(); + return this; })(); } - get subject() { + async getSubject() { + return new (require('./Subject'))(this.subjectId); + } + }