None to bool

This commit is contained in:
Raykov-MS 2026-05-21 16:19:54 +03:00
parent ed4c02589b
commit 03cd022dac

View File

@ -105,7 +105,7 @@ class UserRepository:
query = select(UserOrg.org_unit_id).where(UserOrg.user_id == user_id) query = select(UserOrg.org_unit_id).where(UserOrg.user_id == user_id)
return (await self.db.execute(query)).scalars().all() return (await self.db.execute(query)).scalars().all()
async def set_many_ssp(self, user_id: int, ssp_ids: list[int]) -> None: async def set_many_ssp(self, user_id: int, ssp_ids: list[int]) -> bool:
for ssp_id in ssp_ids: for ssp_id in ssp_ids:
await self.db.execute( await self.db.execute(
text( text(
@ -114,8 +114,9 @@ class UserRepository:
{"user_id": user_id, "org_unit_id": ssp_id}, {"user_id": user_id, "org_unit_id": ssp_id},
) )
await self.db.commit() await self.db.commit()
return True
async def unset_many_ssp(self, user_id: int, ssp_ids: list[int]) -> None: async def unset_many_ssp(self, user_id: int, ssp_ids: list[int]) -> bool:
for ssp_id in ssp_ids: for ssp_id in ssp_ids:
await self.db.execute( await self.db.execute(
text( text(
@ -124,6 +125,7 @@ class UserRepository:
{"user_id": user_id, "org_unit_id": ssp_id}, {"user_id": user_id, "org_unit_id": ssp_id},
) )
await self.db.commit() await self.db.commit()
return True
async def clear_many_ssp(self, user_id: int) -> None: async def clear_many_ssp(self, user_id: int) -> None:
org_unit_ids = await self.get_many_ssp_ids(user_id) org_unit_ids = await self.get_many_ssp_ids(user_id)