Skip to content
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

Implement FlagFeedbackEvent Serializer, ViewSet and Permissions #4479

Closed
ozer550 opened this issue Mar 20, 2024 · 2 comments · Fixed by #4537
Closed

Implement FlagFeedbackEvent Serializer, ViewSet and Permissions #4479

ozer550 opened this issue Mar 20, 2024 · 2 comments · Fixed by #4537
Assignees
Labels
DEV: backend P1 - important Priority: High impact on UX python Pull requests that update Python code

Comments

@ozer550
Copy link
Member

ozer550 commented Mar 20, 2024

Overview

This issue involves creating the FlagFeedbackEventSerializer, FlagFeedbackEventViewSet and setting up the appropriate permissions for create, destroy, and list actions according to specific user roles and feature flags. Additionally, URL routes need to be defined for accessing these views.

Depends on #4478

Description and outcomes

FlagFeedbackEventSerializer Class::

  • Implement a serializer class named FlagFeedbackEventSerializer.
  • Inherit properties from BaseFeedbackSerializer, BaseFeedbackEventSerializer, and BaseFeedbackInteractionEventSerializer.
  • Add a field for target_topic_id (UUID).
  • Implement the create method to instantiate a FlagFeedbackEvent object from validated data.
  • Proper unit tests for serializers.

FlagFeedbackEventViewSet:

  • Implement a ViewSet for FlagFeedbackEvent with actions for create, update, partial_update, destroy, and list.

  • Ensure queryset is set to FlagFeedbackEvent.objects.all()

  • Serializer class is FlagFeedbackEventSerializer

    Permissions:

    • Define a custom permissions class that:
      • Allows create action for users who have a specific feature flag enabled and for admins.
      • Allows destroy action only for admins, enabling them to review and remove feedback.
      • Restricts list action to admins only, allowing them to view all feedback events.
      • Use the custom permissions approach discussed above to apply these rules.

URL Routing:

  • Define URL routes for the FlagFeedbackEventViewSet in the application's urls.py.
  • Ensure that the URLs are correctly connected to the respective actions in the viewset.

Unit Tests:

  • Write unit tests to cover the new serializer and viewset functionality.
  • This includes testing permission logic, action behaviors (create, update, destroy, list), and successful URL routing.

Acceptance criteria

  • FlagFeedbackEventSerializer correctly serializes and deserializes data as per the defined fields and inherits properties from base serializers.
  • FlagFeedbackEventViewSet handles CRUD operations with the specified permissions logic accurately implemented.
  • Custom permissions class effectively restricts access to actions based on user roles and feature flags.
  • URL routes for FlagFeedbackEventViewSet are correctly defined and tested.
  • All unit tests pass, demonstrating the functionality works as expected and permissions are correctly enforced.
  • Documentation provides clear guidance on the viewset's behavior and permissions.
@ozer550 ozer550 added P1 - important Priority: High impact on UX DEV: backend python Pull requests that update Python code labels Mar 20, 2024
@ozer550 ozer550 added this to the Studio: Feedback Mechanism milestone Mar 20, 2024
@imSanko
Copy link

imSanko commented Mar 29, 2024

Can I work on this issue?

@MisRob
Copy link
Member

MisRob commented Apr 1, 2024

Hello @imSanko, thank you for volunteering. This issue is not open for contribution. Please find a "help wanted" issue with no assignee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend P1 - important Priority: High impact on UX python Pull requests that update Python code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants