mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 17:59:25 +00:00
Add ability to extract Subject from Class
This commit is contained in:
13
lib/Class.js
13
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user