Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active Dec 10, 2020
Embed
What would you like to do?
class Teacher {
static getByID(id) {
//go to the coupled database
}
constructor(id, fullName) {
this.id = id;
this.fullName = fullName;
}
}
class School {
static getByID(id) {
//go to the coupled database
}
constructor(id, address) {
this.id = id;
this.address = address;
}
}
class Student {
constructor(firstName, lastName, id, teacherId, schoolId) {
this.firstName = firstName;
this.lastName = lastName;
this.id = id;
this.teacherId = teacherId;
this.schoolId = schoolId;
}
school() {
return School.getById(this.schoolId);
}
teacher() {
return Teacher.getById(this.teacherId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment