#11 Added endpoint to get enrolled courses

This commit is contained in:
2023-04-06 16:40:40 -04:00
parent 5beaf2dba4
commit 84fb1e9f4b
2 changed files with 17 additions and 1 deletions

View File

@@ -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