-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
Currently, we have duplicate functionality between ListStudentInfoView and StudentViewSet.
Plan to consolidate these by enhancing StudentSerializer and removing the duplicate view.
Current Implementation
ListStudentInfoView: Handles formatted student info displayStudentViewSet: Handles basic CRUD with raw data- Duplicate logic for retrieving student data
- Two separate routes for similar functionality
Proposed Changes
-
Enhance StudentSerializer:
- Add formatted fields:
- user_name
- gender_display
- email (from User)
- class_name (from Class)
- teacher_name (from Teacher)
- Handle proper field formatting
- Add related field validations
- Add formatted fields:
-
Remove ListStudentInfoView:
- Remove the duplicate view
- Update URL routing
- Ensure all current functionality is preserved in StudentViewSet
Expected Results
- Single source of truth for student data formatting
- Cleaner and more maintainable code
- Same functionality through unified StudentViewSet
- Better separation of concerns (data formatting in Serializer)
Tasks
- Enhance StudentSerializer with formatted fields
- Add proper field validations
- Remove ListStudentInfoView
- Update URL routing
- Test all existing functionality still works
- Update API documentation
Notes
- Can keep current functionality while implementing changes
- Consider handling null values in related fields
- May need to update any frontend code using the old endpoint