1
0
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:
2022-02-25 19:52:45 +00:00
parent 6ee3e90f9b
commit d5bc5a9619

View File

@@ -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);
}
} }