Skip to content

Implement FlagFeedbackEvent Serializer, ViewSet and Permissions #4479

Closed

Description

@ozer550

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.

Activity

  1. imSanko commented on Mar 29, 2024

    @imSanko

    Can I work on this issue?

  2. MisRob commented on Apr 1, 2024

    @MisRob
    Member

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

  3. self-assigned this
    on Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

DEV: backendP1 - importantPriority: High impact on UXpythonPull requests that update Python code

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions