-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
feat(dashboards): Update the endpoint to use manager to favorite #93625
Conversation
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.
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
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 |
if not request.user.is_authenticated: | ||
return Response(status=401) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests make sense 🚢
) 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. 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. Enforcing positions to be filled in will be a separate PR, for now this is feature flagged so it can make this assumption.