-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(sentry apps): Add HC methods to fetch sentry apps for an org and update a sentry app #98080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c083a02
52f0ba6
b2254d1
b2ad78c
543b6a4
523c76a
62d1e24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
RpcSentryAppService, | ||
SentryAppInstallationFilterArgs, | ||
) | ||
from sentry.sentry_apps.services.app.model import SentryAppUpdateArgs | ||
from sentry.sentry_apps.services.app.serial import ( | ||
serialize_sentry_app, | ||
serialize_sentry_app_component, | ||
|
@@ -333,6 +334,33 @@ def get_published_sentry_apps_for_organization( | |
) | ||
return [serialize_sentry_app(app) for app in published_apps] | ||
|
||
def get_sentry_apps_for_organization(self, *, organization_id: int) -> list[RpcSentryApp]: | ||
""" | ||
Get active Sentry Apps for a given organization | ||
""" | ||
sentry_apps = SentryApp.objects.filter( | ||
owner_id=organization_id, application__isnull=False | ||
).exclude(status=SentryAppStatus.DELETION_IN_PROGRESS) | ||
return [serialize_sentry_app(app) for app in sentry_apps] | ||
|
||
def update_sentry_app( | ||
self, | ||
*, | ||
id: int, | ||
attrs: SentryAppUpdateArgs, | ||
) -> RpcSentryApp | None: | ||
try: | ||
sentry_app = SentryApp.objects.get(id=id) | ||
except SentryApp.DoesNotExist: | ||
return None | ||
|
||
if len(attrs): | ||
for k, v in attrs.items(): | ||
setattr(sentry_app, k, v) | ||
sentry_app.save() | ||
ceorourke marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: ORM Bypass Causes Data Validation FailuresThe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I based it off of https://github.com/getsentry/sentry/blob/master/src/sentry/users/services/user/impl.py#L169 which seems fine |
||
|
||
return serialize_sentry_app(sentry_app) | ||
|
||
def get_internal_integrations( | ||
self, *, organization_id: int, integration_name: str | ||
) -> list[RpcSentryApp]: | ||
|
Uh oh!
There was an error while loading. Please reload this page.