File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class Client(Base):
2828
2929 __tablename__ = "clients"
3030
31- id = Column (
31+ id : Mapped [ uuid . UUID ] = mapped_column (
3232 PGUUID (as_uuid = True ),
3333 primary_key = True ,
3434 default = uuid .uuid4 ,
Original file line number Diff line number Diff line change @@ -89,24 +89,24 @@ async def get_guides(
8989 self ,
9090 session : AsyncSession ,
9191 current_client : Client ,
92- topic_id : UUID ,
92+ topic_id : UUID | None = None ,
9393 skip : int = 0 ,
9494 limit : int = 100 ,
9595 ) -> list [Guide ]:
96- # Verify topic access first
97- await self .get_topic (session , current_client , topic_id )
96+ # Verify topic access first if provided
97+ if topic_id :
98+ await self .get_topic (session , current_client , topic_id )
9899
99100 # Filter guides
100- query = (
101- select (Guide )
102- .where (
103- Guide .topic_id == topic_id ,
104- or_ (Guide .client_id .is_ (None ), Guide .client_id == current_client .id ),
105- )
106- .offset (skip )
107- .limit (limit )
101+ query = select (Guide ).where (
102+ or_ (Guide .client_id .is_ (None ), Guide .client_id == current_client .id )
108103 )
109104
105+ if topic_id :
106+ query = query .where (Guide .topic_id == topic_id )
107+
108+ query = query .offset (skip ).limit (limit )
109+
110110 result = await session .execute (query )
111111 return list (result .scalars ().all ())
112112
You can’t perform that action at this time.
0 commit comments