#6 Added unenroll endpoint by sending DELETE request to enroll endpoint

This commit is contained in:
2023-04-06 19:06:44 -04:00
parent 8ec489beb3
commit b71c23d706
2 changed files with 24 additions and 0 deletions

View File

@@ -46,6 +46,13 @@ class User(UserMixin, db.Model):
return True
return False
def unenroll(self, c) -> bool:
if self.is_enrolled(c):
self.enrolled_courses.remove(c)
db.session.commit()
return True
return False
def to_dict(self) -> dict:
return {
"id": self.id,