feat(chalice): fixed slack name existence check

feat(chalice): fixed role name existence check
This commit is contained in:
Taha Yassine Kraiem 2023-02-07 12:07:50 +01:00
parent 8a2fe71ca7
commit b73df744fc
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@ from chalicelib.utils.TimeUTC import TimeUTC
def __exists_by_name(tenant_id: int, name: str, exclude_id: Optional[int]) -> bool:
with pg_client.PostgresClient() as cur:
query = cur.mogrify(f"""SELECT EXISTS(SELECT count(1) AS count
query = cur.mogrify(f"""SELECT EXISTS(SELECT 1
FROM public.roles
WHERE tenant_id = %(tenant_id)s
AND name ILIKE %(name)s

View file

@ -115,7 +115,7 @@ def add(tenant_id, endpoint, auth_header=None, webhook_type='webhook', name="",
def exists_by_name(tenant_id: int, name: str, exclude_id: Optional[int],
webhook_type: str = schemas.WebhookType.webhook) -> bool:
with pg_client.PostgresClient() as cur:
query = cur.mogrify(f"""SELECT EXISTS(SELECT count(1) AS count
query = cur.mogrify(f"""SELECT EXISTS(SELECT 1
FROM public.webhooks
WHERE name ILIKE %(name)s
AND deleted_at ISNULL