File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,7 +159,14 @@ async def find_journals(
159159 Return list of journals for requested user.
160160 """
161161 query = (
162- db_session .query (Journal )
162+ db_session .query (
163+ Journal .id ,
164+ Journal .bugout_user_id ,
165+ func .array_agg (JournalPermissions .holder_id ).label ("holders_ids" ),
166+ Journal .name ,
167+ Journal .created_at ,
168+ Journal .updated_at ,
169+ )
163170 .join (JournalPermissions , JournalPermissions .journal_id == Journal .id )
164171 .join (SpireOAuthScopes , JournalPermissions .permission == SpireOAuthScopes .scope )
165172 .filter (SpireOAuthScopes .api == "journals" , Journal .deleted == False )
@@ -171,6 +178,13 @@ async def find_journals(
171178 JournalPermissions .holder_id == user_id ,
172179 )
173180 )
181+ .group_by (
182+ Journal .id ,
183+ Journal .bugout_user_id ,
184+ Journal .name ,
185+ Journal .created_at ,
186+ Journal .updated_at ,
187+ )
174188 )
175189
176190 journals = query .all ()
Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ async def list_journals(
460460 JournalResponse (
461461 id = journal .id ,
462462 bugout_user_id = journal .bugout_user_id ,
463- holder_ids = { holder . holder_id for holder in journal .permissions } ,
463+ holder_ids = journal .holders_ids ,
464464 name = journal .name ,
465465 created_at = journal .created_at ,
466466 updated_at = journal .updated_at ,
You can’t perform that action at this time.
0 commit comments