From ab5c1ffba6a5e7e68c85b1e041a107e1ecdac355 Mon Sep 17 00:00:00 2001 From: ajay-sentry <159853603+ajay-sentry@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:38:36 -0800 Subject: [PATCH 1/2] feat: Add Stripe_id to Django Admin (#1104) --- codecov_auth/admin.py | 7 +++++-- requirements.in | 2 +- requirements.txt | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/codecov_auth/admin.py b/codecov_auth/admin.py index 26c2be5f47..f07cebceb0 100644 --- a/codecov_auth/admin.py +++ b/codecov_auth/admin.py @@ -726,6 +726,7 @@ class PlansInline(admin.TabularInline): "monthly_uploads_limit", "paid_plan", "is_active", + "stripe_id", ] formfield_overrides = { Plan._meta.get_field("benefits"): {"widget": Textarea(attrs={"rows": 3})}, @@ -791,12 +792,13 @@ class PlanAdmin(admin.ModelAdmin): list_display = ( "name", "marketing_name", - "base_unit_price", "is_active", + "tier", "paid_plan", + "billing_rate", + "base_unit_price", "max_seats", "monthly_uploads_limit", - "billing_rate", ) list_filter = ("is_active", "paid_plan", "billing_rate", "tier") search_fields = ("name__iregex", "marketing_name__iregex") @@ -811,6 +813,7 @@ class PlanAdmin(admin.ModelAdmin): "max_seats", "monthly_uploads_limit", "paid_plan", + "stripe_id", ] formfield_overrides = { Plan._meta.get_field("benefits"): {"widget": Textarea(attrs={"rows": 3})}, diff --git a/requirements.in b/requirements.in index c69e57df8a..5bea32f01f 100644 --- a/requirements.in +++ b/requirements.in @@ -26,7 +26,7 @@ freezegun google-cloud-pubsub gunicorn>=22.0.0 https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem -https://github.com/codecov/shared/archive/b38e7f3813d4fc795d0e7cf852eced4660daa4ac.tar.gz#egg=shared +https://github.com/codecov/shared/archive/fe16480b3646a616ff412d5c0a28cafd2c7104c1.tar.gz#egg=shared https://github.com/photocrowd/django-cursor-pagination/archive/f560902696b0c8509e4d95c10ba0d62700181d84.tar.gz idna>=3.7 minio diff --git a/requirements.txt b/requirements.txt index ab826a6dcf..f88b5e98d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.13 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile requirements.in @@ -416,7 +416,7 @@ sentry-sdk[celery]==2.13.0 # shared setproctitle==1.1.10 # via -r requirements.in -shared @ https://github.com/codecov/shared/archive/b38e7f3813d4fc795d0e7cf852eced4660daa4ac.tar.gz +shared @ https://github.com/codecov/shared/archive/fe16480b3646a616ff412d5c0a28cafd2c7104c1.tar.gz # via -r requirements.in simplejson==3.17.2 # via -r requirements.in From 9f89174ddb69700df7efdadde947d5fcfe2e7144 Mon Sep 17 00:00:00 2001 From: Spencer Murray <159931558+spalmurray-codecov@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:37:28 -0500 Subject: [PATCH 2/2] feat: Add repoid to repository graphql schema (#1095) --- graphql_api/tests/test_repository.py | 5 +++++ graphql_api/types/repository/repository.graphql | 1 + graphql_api/types/repository/repository.py | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/graphql_api/tests/test_repository.py b/graphql_api/tests/test_repository.py index c3cbbed093..259d9952e5 100644 --- a/graphql_api/tests/test_repository.py +++ b/graphql_api/tests/test_repository.py @@ -51,6 +51,7 @@ """ default_fields = """ + repoid name active private @@ -103,6 +104,7 @@ def setUp(self): @freeze_time("2021-01-01") def test_when_repository_has_no_coverage(self): repo = RepositoryFactory( + repoid=1, author=self.owner, active=True, private=True, @@ -122,6 +124,7 @@ def test_when_repository_has_no_coverage(self): + "coverageAnalytics { percentCovered commitSha hits misses lines },", ) == { "__typename": "Repository", + "repoid": 1, "name": "a", "active": True, "private": True, @@ -154,6 +157,7 @@ def test_when_repository_has_no_coverage(self): @freeze_time("2021-01-01") def test_when_repository_has_coverage(self): repo = RepositoryFactory( + repoid=1, author=self.owner, active=True, private=True, @@ -186,6 +190,7 @@ def test_when_repository_has_coverage(self): + "coverageAnalytics { percentCovered commitSha hits misses lines },", ) == { "__typename": "Repository", + "repoid": 1, "name": "b", "active": True, "latestCommitAt": None, diff --git a/graphql_api/types/repository/repository.graphql b/graphql_api/types/repository/repository.graphql index 22b45bce47..e2dd2d40f6 100644 --- a/graphql_api/types/repository/repository.graphql +++ b/graphql_api/types/repository/repository.graphql @@ -3,6 +3,7 @@ Repository is a named collection of files uploaded """ type Repository { isFirstPullRequest: Boolean! + repoid: Int! name: String! active: Boolean! activated: Boolean! diff --git a/graphql_api/types/repository/repository.py b/graphql_api/types/repository/repository.py index 1dfa95b6a3..65174e8137 100644 --- a/graphql_api/types/repository/repository.py +++ b/graphql_api/types/repository/repository.py @@ -41,6 +41,16 @@ repository_bindable.set_alias("latestCommitAt", "true_latest_commit_at") +@repository_bindable.field("repoid") +def resolve_repoid(repository: Repository, info: GraphQLResolveInfo) -> int: + return repository.repoid + + +@repository_bindable.field("name") +def resolve_name(repository: Repository, info: GraphQLResolveInfo) -> str: + return repository.name + + @repository_bindable.field("oldestCommitAt") def resolve_oldest_commit_at( repository: Repository, info: GraphQLResolveInfo