#6 Added unenroll endpoint by sending DELETE request to enroll endpoint
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user