feat(api): Added Project ID in Body Support for Couple APIs#74371
feat(api): Added Project ID in Body Support for Couple APIs#74371iamrajjoshi merged 3 commits intomasterfrom
Conversation
| ), | ||
| filter_params["end"] if filter_params["end"] else datetime.utcnow(), |
There was a problem hiding this comment.
auto formatted
| @extend_schema_field(field=OpenApiTypes.STR) | ||
| class ProjectField(serializers.Field): | ||
| def __init__(self, scope="project:write"): | ||
| def __init__(self, scope="project:write", id_allowed=False): |
There was a problem hiding this comment.
we should eventually support id lookup everywhere this field is used, but didn't want to pollute this PR with the implications of that
| for slug in result["projects"]: | ||
| if slug not in allowed_projects: |
There was a problem hiding this comment.
I think this logic would have to be updated to reflect the new mapping
| scope.set_tag("version", result["version"]) | ||
|
|
||
| allowed_projects = {p.slug: p for p in self.get_projects(request, organization)} | ||
| projects_from_request = self.get_projects(request, organization) |
There was a problem hiding this comment.
I took a look at get_projects but I couldn't figure out how this would work when the projects is a list of slugs and IDs. Did you take a look at the function?
There was a problem hiding this comment.
discussed offline
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #74371 +/- ##
=======================================
Coverage 78.13% 78.13%
=======================================
Files 6670 6670
Lines 298568 298572 +4
Branches 51375 51376 +1
=======================================
+ Hits 233287 233298 +11
+ Misses 59016 59014 -2
+ Partials 6265 6260 -5
|
| allowed_projects = {project.slug: project for project in projects_from_request} | ||
| allowed_projects.update({project.id: project for project in projects_from_request}) |
There was a problem hiding this comment.
smh i had something better before, what do u want me to do 😭
There was a problem hiding this comment.
how about:
allowed_projects = {}
for project in projects_from_request:
allowed_projects[project.slug] = project
allowed_projects[project.id] = projectThere was a problem hiding this comment.
traditional loops 🙄 , looks good to me
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
I am working on getting all the commands in our Sentry CLI to support Ids as well as Slugs. rough spec
We have already gone through the effort of supporting ids and slugs in path parameters of all the APIs in our codebase. There are some endpoints that the CLI uses that pass in project slugs as body parameters, so we need to support Ids for those as well.