Add series partner and user enrollment mapping functionality#827
Conversation
- Introduced `get_series_partner_id_map_for_group` and `get_user_series_enrollment_partner_map` functions to retrieve mappings for series partners and user enrollments. - Updated the `GroupSeriesListItemDTO` to include `series_partner_id` and `is_enrolled` fields. - Refactored the `_series_to_dtos` function to utilize the new mappings for enhanced series detail retrieval. - Modified the `get_author_group_detail` endpoint to support user authentication and pass user ID for enrollment checks. - Added tests for the new mapping functions and updated existing tests to cover new functionality.
Confidence Score: 4/5The optional-auth group detail path needs a fix before merging.
pecha_api/plans/groups/groups_service.py
|
| user = validate_and_extract_user_details(token=token) | ||
| user_id = user.id | ||
| except Exception: | ||
| pass |
There was a problem hiding this comment.
Rejected Tokens Become Anonymous
When a client sends an expired or malformed bearer token, validate_and_extract_user_details raises an auth error, but this catch-all block discards it and continues with user_id=None. The public group response then returns 200 with is_enrolled=False for every series, so an authenticated client can receive anonymous enrollment state instead of an authentication failure.
|



get_series_partner_id_map_for_groupandget_user_series_enrollment_partner_mapfunctions to retrieve mappings for series partners and user enrollments.GroupSeriesListItemDTOto includeseries_partner_idandis_enrolledfields._series_to_dtosfunction to utilize the new mappings for enhanced series detail retrieval.get_author_group_detailendpoint to support user authentication and pass user ID for enrollment checks.