#11 Added endpoint to get enrolled courses
This commit is contained in:
@@ -80,6 +80,8 @@ class Course(db.Model):
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
d = {}
|
||||
for f in ["id", "name", "description", "instructor", "created_at"]:
|
||||
for f in ["id", "name", "description", "created_at"]:
|
||||
d[f] = getattr(self, f)
|
||||
|
||||
d["instructor"] = User.query.get(self.instructor).username
|
||||
return d
|
||||
|
||||
Reference in New Issue
Block a user