-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Labels
DEV: backendP1 - importantPriority: High impact on UXPriority: High impact on UXpythonPull requests that update Python codePull requests that update Python code
Milestone
Description
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.
- Define a custom permissions class that:
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.
Metadata
Metadata
Assignees
Labels
DEV: backendP1 - importantPriority: High impact on UXPriority: High impact on UXpythonPull requests that update Python codePull requests that update Python code