Skip to content

feat: enhance plan item management with new functionalities#645

Open
tenkus47 wants to merge 8 commits into
developfrom
create-days
Open

feat: enhance plan item management with new functionalities#645
tenkus47 wants to merge 8 commits into
developfrom
create-days

Conversation

@tenkus47
Copy link
Copy Markdown
Member

  • Added functions to retrieve plan days by ID with tasks and subtasks, and to delete multiple days by their IDs.
  • Introduced request models for creating and deleting days, allowing for batch operations.
  • Updated service and view layers to support the new functionalities, including API endpoints for creating and deleting days.
  • Enhanced tests to cover the new features and ensure proper functionality.

- Added functions to retrieve plan days by ID with tasks and subtasks, and to delete multiple days by their IDs.
- Introduced request models for creating and deleting days, allowing for batch operations.
- Updated service and view layers to support the new functionalities, including API endpoints for creating and deleting days.
- Enhanced tests to cover the new features and ensure proper functionality.
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 29, 2026

Confidence Score: 5/5

Safe to merge; the logic changes are well-covered by tests and no blocking defects were found in the changed paths.

The bulk-update fix, new batch endpoints, and task-copy logic all look correct. Test coverage for the new _copy_tasks_and_subtasks_to_days helper is thorough. The two findings are both minor: a duplicate mock alias in one test (makes assertions weaker but doesn't cause false passes in practice given the test's setup) and two unused imports left over from the refactor.

No files require special attention.

Reviews (6): Last reviewed commit: "feat: add function to retrieve plan day ..." | Re-trigger Greptile

Comment thread pecha_api/plans/items/plan_items_services.py
Comment thread pecha_api/plans/items/plan_items_services.py
Comment thread pecha_api/plans/items/plan_items_services.py
tenkus47 added 7 commits May 29, 2026 11:33
- Added logging for integrity errors during plan item saving operations.
- Updated HTTP status codes for error responses to align with RESTful standards.
- Refactored functions to enhance readability and maintainability, including the introduction of a new helper function for author plan retrieval.
- Enhanced test cases to ensure proper error propagation and validate new functionalities.
- Implemented tests for creating plan items with task copying from a source day.
- Added tests for deleting plan days and handling unauthorized access.
- Introduced tests for reordering days and deleting associated audio files.
- Enhanced existing tests to cover edge cases and ensure proper error handling.
- Changed parameter names in the `update_days_in_bulk_by_plan_id` function to improve clarity and consistency.
- Updated binding parameters from "id" and "day_number" to "b_id" and "b_day_number" respectively for better context.
- Updated the `_get_author_plan` function to include author ID validation, ensuring that only the correct author can access their plans.
- Refactored the plan retrieval logic to use `get_plan_by_id` instead of `get_plan_by_id_and_created_by`, simplifying the function and improving clarity.
- Added a new error response for author mismatches to enhance security and user feedback.
- Updated tests to reflect changes in the plan retrieval logic and author validation.
- Changed import statements to include new request models for creating and deleting days.
- Updated the delete function to support deleting multiple plan days, enhancing functionality.
- Introduced `get_plan_day_by_id_any_plan` to fetch a plan day by its ID, including related tasks and subtasks.
- Updated the `create_plan_item` function to utilize the new retrieval method, enhancing cross-plan copying functionality.
- Modified tests to ensure proper validation and access control for copying tasks between plans.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant