Unify the way alerts and users are handled on the DB side

This commit is contained in:
2024-12-03 16:59:13 -08:00
parent 50f65abced
commit 9a36bb3f47
4 changed files with 39 additions and 22 deletions

View File

@@ -60,3 +60,11 @@ class UsersController:
await user.get(self.table)
user.subscribed_alerts.append(alert)
await user.put(self.table)
async def remove_alert(self, user: int | User, alert: str | Alert) -> None:
user = self._user_to_obj(user)
alert = self._alert_to_obj(alert)
await user.get(self.table)
user.subscribed_alerts.remove(alert)
await user.put(self.table)