merge search endpoints

+ fix: favorites endpoint not filtering by logged in user
This commit is contained in:
cwilvx
2024-10-21 08:50:09 +03:00
parent e689d81d81
commit a7666ad935
3 changed files with 60 additions and 93 deletions
+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