mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 22:59:28 +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;
|
subjectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subject the class is for
|
||||||
|
* @type {Subject}
|
||||||
|
*/
|
||||||
|
subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the class
|
* The name of the class
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -48,11 +54,16 @@ class Class {
|
|||||||
for (const [ k, v ] of Object.entries(record[0]))
|
for (const [ k, v ] of Object.entries(record[0]))
|
||||||
this[k] = v;
|
this[k] = v;
|
||||||
|
|
||||||
|
this.subject = await this.getSubject();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
get subject() {
|
async getSubject() {
|
||||||
|
return new (require('./Subject'))(this.subjectId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user