merge search endpoints

+ fix: favorites endpoint not filtering by logged in user
This commit is contained in:
cwilvx committed 2024-10-21 08:50:09 +03:00
1 parent e689d81d81
commit a7666ad935
3 files changed
+60 -93

No files matched your search

+7 -2
View File
@@ -184,9 +184,14 @@ class FavoritesTable(Base):
)
@classmethod
def get_all(cls):
def get_all(cls, with_user: bool = False):
with DbEngine.manager() as conn:
result = conn.execute(select(cls))
if with_user:
result = conn.execute(
select(cls).where(cls.userid == get_current_userid())
)
else:
result = conn.execute(select(cls))
return favorites_to_dataclass(result.fetchall())
@classmethod