mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 22:24:56 -04:00
Convert simple_select_one and simple_select_one_onecol to async (#8162)
This commit is contained in:
parent
56efa9ec71
commit
4c6c56dc58
25 changed files with 220 additions and 113 deletions
|
@ -14,7 +14,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from synapse.api.errors import SynapseError
|
||||
from synapse.storage._base import SQLBaseStore, db_to_json
|
||||
|
@ -28,8 +28,8 @@ _DEFAULT_ROLE_ID = ""
|
|||
|
||||
|
||||
class GroupServerWorkerStore(SQLBaseStore):
|
||||
def get_group(self, group_id):
|
||||
return self.db_pool.simple_select_one(
|
||||
async def get_group(self, group_id: str) -> Optional[Dict[str, Any]]:
|
||||
return await self.db_pool.simple_select_one(
|
||||
table="groups",
|
||||
keyvalues={"group_id": group_id},
|
||||
retcols=(
|
||||
|
@ -351,8 +351,10 @@ class GroupServerWorkerStore(SQLBaseStore):
|
|||
)
|
||||
return bool(result)
|
||||
|
||||
def is_user_admin_in_group(self, group_id, user_id):
|
||||
return self.db_pool.simple_select_one_onecol(
|
||||
async def is_user_admin_in_group(
|
||||
self, group_id: str, user_id: str
|
||||
) -> Optional[bool]:
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
table="group_users",
|
||||
keyvalues={"group_id": group_id, "user_id": user_id},
|
||||
retcol="is_admin",
|
||||
|
@ -360,10 +362,12 @@ class GroupServerWorkerStore(SQLBaseStore):
|
|||
desc="is_user_admin_in_group",
|
||||
)
|
||||
|
||||
def is_user_invited_to_local_group(self, group_id, user_id):
|
||||
async def is_user_invited_to_local_group(
|
||||
self, group_id: str, user_id: str
|
||||
) -> Optional[bool]:
|
||||
"""Has the group server invited a user?
|
||||
"""
|
||||
return self.db_pool.simple_select_one_onecol(
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
table="group_invites",
|
||||
keyvalues={"group_id": group_id, "user_id": user_id},
|
||||
retcol="user_id",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue