Skip to content

Commit cccb0a1

Browse files
committed
fix: add platform field to identity queries and update affiliation domain
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent b524c49 commit cccb0a1

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

services/apps/git_integration/src/crowdgit/database/crud.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,30 +667,32 @@ async def find_many_organization_ids_by_identities(identities: list[dict]) -> li
667667
param_index = 1
668668
for idx, identity in enumerate(identities):
669669
values_parts.append(
670-
f"(${param_index}::int, ${param_index + 1}::text,"
671-
f" ${param_index + 2}::boolean, ${param_index + 3}::text)"
670+
f"(${param_index}::int, ${param_index + 1}::text, ${param_index + 2}::boolean,"
671+
f" ${param_index + 3}::text, ${param_index + 4}::text)"
672672
)
673673
params.extend(
674674
[
675675
idx,
676676
identity["type"],
677677
identity.get("verified", True),
678+
identity["platform"],
678679
identity["value"],
679680
]
680681
)
681-
param_index += 4
682+
param_index += 5
682683

683684
matches_by_idx: dict[int, set[str]] = {}
684685
rows = await query(
685686
f"""
686-
WITH input_identities (idx, identity_type, verified, value) AS (
687+
WITH input_identities (idx, identity_type, verified, platform, value) AS (
687688
VALUES {", ".join(values_parts)}
688689
)
689690
SELECT i.idx, oi."organizationId"
690691
FROM input_identities i
691692
LEFT JOIN "organizationIdentities" oi
692693
ON oi.type = i.identity_type
693694
AND oi.verified = i.verified
695+
AND oi.platform = i.platform
694696
AND lower(oi.value) = lower(i.value)
695697
ORDER BY i.idx
696698
""",
@@ -708,6 +710,7 @@ async def find_many_organization_ids_by_identities(identities: list[dict]) -> li
708710
results.append(
709711
{
710712
"type": identity["type"],
713+
"platform": identity["platform"],
711714
"value": identity["value"],
712715
"verified": identity.get("verified", True),
713716
"organization_id": organization_id,

services/apps/git_integration/src/crowdgit/services/affiliation/affiliation_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def group_parse_rows(
412412
if is_unaffiliated:
413413
stint = AffiliationOrganizationStint(
414414
name="Individual",
415-
domain="individual-noaccount.com",
415+
domain="nonameaccount.com",
416416
date_start=cls._parse_optional_date(organization.date_start),
417417
date_end=cls._parse_optional_date(organization.date_end),
418418
is_unaffiliated=True,
@@ -744,6 +744,7 @@ async def apply_affiliations(
744744
organization_identity_inputs.append(
745745
{
746746
"type": "primary-domain",
747+
"platform": "email",
747748
"value": organization.domain,
748749
"verified": True,
749750
}

0 commit comments

Comments
 (0)