Skip to content

Commit 5c501a8

Browse files
authored
Merge pull request #4450 from nickmango/release-gh-org
[#4433] Bug/Adding GH Org
2 parents 8284076 + 693c7ee commit 5c501a8

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

.github/workflows/yarn-scan-backend-go-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
99
pull_request:
1010
branches:
11-
- main
11+
- dev
1212

1313
jobs:
1414
yarn-scan-backend-go-pr:

.github/workflows/yarn-scan-backend-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
99
pull_request:
1010
branches:
11-
- main
11+
- dev
1212

1313
jobs:
1414
yarn-scan-backend-pr:

cla-backend-go/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ setup-swagger:
6969

7070
setup_dev: setup-dev
7171
setup-dev:
72-
pushd /tmp && echo "==> Installing goimport..." && go install golang.org/x/tools/cmd/goimports@latest && echo "==> Installation coverage tools..." && go install golang.org/x/tools/cmd/cover@latest && popd
72+
pushd /tmp && echo "==> Installing goimport..." && go install golang.org/x/tools/cmd/goimports@v0.24.0 && echo "==> Installation coverage tools..." && go install golang.org/x/tools/cmd/cover@latest && popd
7373

7474
@echo "==> Installing linter..."
7575
@# Latest releases: https://github.com/golangci/golangci-lint/releases

cla-backend/cla/models/dynamo_models.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,20 @@ class Meta:
500500

501501
organization_name_lower = UnicodeAttribute(hash_key=True)
502502

503+
class OrganizationNameLowerSearchIndex(GlobalSecondaryIndex):
504+
"""
505+
This class represents a global secondary index for querying organizations by Organization Name.
506+
"""
507+
508+
class Meta:
509+
"""Meta class for external ID github org index."""
510+
511+
index_name = "organization-name-lower-search-index"
512+
write_capacity_units = int(cla.conf["DYNAMO_WRITE_UNITS"])
513+
read_capacity_units = int(cla.conf["DYNAMO_READ_UNITS"])
514+
projection = AllProjection()
515+
516+
organization_name_lower = UnicodeAttribute(hash_key=True)
503517

504518
class GitlabExternalGroupIDIndex(GlobalSecondaryIndex):
505519
"""
@@ -3817,7 +3831,8 @@ class Meta:
38173831
project_sfid = UnicodeAttribute()
38183832
organization_sfid_index = GitlabOrgSFIndex()
38193833
project_sfid_organization_name_index = GitlabOrgProjectSfidOrganizationNameIndex()
3820-
organization_name_lowe_index = GitlabOrganizationNameLowerIndex()
3834+
organization_name_lower_index = GitlabOrganizationNameLowerIndex()
3835+
organization_name_lower_search_index = OrganizationNameLowerSearchIndex()
38213836
organization_project_id = UnicodeAttribute(null=True)
38223837
organization_company_id = UnicodeAttribute(null=True)
38233838
auto_enabled = BooleanAttribute(null=True)
@@ -3964,7 +3979,7 @@ def get_organization_by_installation_id(self, installation_id):
39643979
return None
39653980

39663981
def get_organization_by_lower_name(self, organization_name):
3967-
org_generator = self.model.scan(organization_name_lower__eq=organization_name.lower())
3982+
org_generator = self.model.organization_name_lower_search_index.query(organization_name.lower())
39683983
for org_model in org_generator:
39693984
org = GitHubOrg()
39703985
org.model = org_model

cla-backend/cla/tests/unit/test_gh_org_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ def test_set_organization_name(gh_instance):
3535
def test_get_org_by_name_lower(gh_instance):
3636
""" Test getting GitHub org with case insensitive search """
3737
gh_org = cla.utils.get_github_organization_instance()
38-
gh_org.model.scan = Mock(return_value=[gh_instance.model])
38+
gh_org.model.organization_name_lower_search_index.query = Mock(return_value=[gh_instance.model])
3939
found_gh_org = gh_org.get_organization_by_lower_name(gh_instance.get_organization_name())
4040
assert found_gh_org.get_organization_name_lower() == gh_instance.get_organization_name_lower()

0 commit comments

Comments
 (0)