Skip to content

feat(dashboards): Update the endpoint to use manager to favorite #93625

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

Conversation

narsaynorath
Copy link
Member

This updates the endpoint so it uses the DashboardFavoriteUser manager to create updates. This has the benefit that the API will update positions as well.

These tests and uses currently expect that all positions are set properly, or else the operations will error trying to increment or decrement positions. Enforcing positions to be filled in will be a separate PR, for now this is feature flagged so it can make this assumption.

This updates the endpoint so it uses the DashboardFavoriteUser manager
to create updates. This has the benefit that the API will update
positions as well. These tests and uses currently expect that all
positions are set properly, or else the operations will error trying to
increment or decrement positions.
@narsaynorath narsaynorath requested review from a team as code owners June 16, 2025 17:11
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 16, 2025
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ry/api/endpoints/organization_dashboard_details.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #93625      +/-   ##
==========================================
- Coverage   88.01%   83.29%   -4.73%     
==========================================
  Files       10324    10326       +2     
  Lines      595076   595645     +569     
  Branches    23125    23125              
==========================================
- Hits       523749   496127   -27622     
- Misses      70834    99025   +28191     
  Partials      493      493              

Comment on lines +220 to +221
if not request.user.is_authenticated:
return Response(status=401)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add this because the calls to the helpers from the DashboardFavoriteUser object managers were complaining. user_id is typed as an int and without this call, the typing of the request.user object is possibly AnonymousUser which I suppose doesn't have an ID

Checking for auth fixes the type issue

Copy link
Contributor

@Abdkhan14 Abdkhan14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests make sense 🚢

@narsaynorath narsaynorath merged commit c9754ad into master Jun 17, 2025
64 checks passed
@narsaynorath narsaynorath deleted the narsaynorath/dain-540-update-the-endpoint-to-append-to-the-last-position branch June 17, 2025 13:28
billyvg pushed a commit that referenced this pull request Jun 18, 2025
)

This updates the endpoint so it uses the DashboardFavoriteUser manager
to create updates. This has the benefit that the API will update
positions as well.

These tests and uses currently expect that all positions are set
properly, or else the operations will error trying to increment or
decrement positions. Enforcing positions to be filled in will be a
separate PR, for now this is feature flagged so it can make this
assumption.
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
)

This updates the endpoint so it uses the DashboardFavoriteUser manager
to create updates. This has the benefit that the API will update
positions as well.

These tests and uses currently expect that all positions are set
properly, or else the operations will error trying to increment or
decrement positions. Enforcing positions to be filled in will be a
separate PR, for now this is feature flagged so it can make this
assumption.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants