Skip to content

Commit

Permalink
[#4433] Bug/Adding GH Org
Browse files Browse the repository at this point in the history
- Resolved Github Org installation event issue

Signed-off-by: Harold Wanyama <[email protected]>
  • Loading branch information
nickmango committed Sep 30, 2024
1 parent b7d61b4 commit ef37aa0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions cla-backend/cla/models/dynamo_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,20 @@ class Meta:

organization_name_lower = UnicodeAttribute(hash_key=True)

class OrganizationNameLowerSearchIndex(GlobalSecondaryIndex):
"""
This class represents a global secondary index for querying organizations by Organization Name.
"""

class Meta:
"""Meta class for external ID github org index."""

index_name = "organization-name-lower-search-index"
write_capacity_units = int(cla.conf["DYNAMO_WRITE_UNITS"])
read_capacity_units = int(cla.conf["DYNAMO_READ_UNITS"])
projection = AllProjection()

organization_name_lower = UnicodeAttribute(hash_key=True)

class GitlabExternalGroupIDIndex(GlobalSecondaryIndex):
"""
Expand Down Expand Up @@ -3817,7 +3831,8 @@ class Meta:
project_sfid = UnicodeAttribute()
organization_sfid_index = GitlabOrgSFIndex()
project_sfid_organization_name_index = GitlabOrgProjectSfidOrganizationNameIndex()
organization_name_lowe_index = GitlabOrganizationNameLowerIndex()
organization_name_lower_index = GitlabOrganizationNameLowerIndex()
organization_name_lower_search_index = OrganizationNameLowerSearchIndex()
organization_project_id = UnicodeAttribute(null=True)
organization_company_id = UnicodeAttribute(null=True)
auto_enabled = BooleanAttribute(null=True)
Expand Down Expand Up @@ -3964,7 +3979,7 @@ def get_organization_by_installation_id(self, installation_id):
return None

def get_organization_by_lower_name(self, organization_name):
org_generator = self.model.scan(organization_name_lower__eq=organization_name.lower())
org_generator = self.model.organization_name_lower_search_index.query(organization_name.lower())
for org_model in org_generator:
org = GitHubOrg()
org.model = org_model
Expand Down

0 comments on commit ef37aa0

Please sign in to comment.