mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
merge search endpoints
+ fix: favorites endpoint not filtering by logged in user
This commit is contained in:
+7
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user