Skip to content

Replace MessageResponse with specific responses #2185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 6, 2025
Merged

Conversation

gantoine
Copy link
Member

@gantoine gantoine commented Aug 2, 2025

Description
Explain the changes or enhancements you are proposing with this pull request.

  • Removal of generic MessageResponse in favor of specific response types like TaskExecutionResponse, TaskStatusResponse, and BulkOperationResponse
  • Addition of a new task API module with proper response typing
  • Conversion of several endpoints to return None for operations that don't need response data
  • Hardcoded success messages in frontend components instead of relying on API responses

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Copy link

trunk-io bot commented Aug 2, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link

github-actions bot commented Aug 2, 2025

Test Results

548 tests  +5   547 ✅ +5   1m 0s ⏱️ -1s
  1 suites ±0     1 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit a6d078d. ± Comparison against base commit a9bc4ad.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Aug 2, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
8737 6156 70% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/config/config_manager.py 46% 🟢
backend/endpoints/auth.py 65% 🟢
backend/endpoints/collections.py 29% 🟢
backend/endpoints/configs.py 38% 🟢
backend/endpoints/firmware.py 27% 🟢
backend/endpoints/platform.py 43% 🟢
backend/endpoints/responses/_init_.py 100% 🟢
backend/endpoints/responses/identity.py 100% 🟢
backend/endpoints/rom.py 39% 🟢
backend/endpoints/sockets/scan.py 23% 🟢
backend/endpoints/tasks.py 100% 🟢
backend/endpoints/user.py 56% 🟢
backend/handler/auth/middleware.py 77% 🟢
backend/handler/filesystem/resources_handler.py 70% 🟢
backend/handler/filesystem/roms_handler.py 70% 🟢
backend/handler/metadata/igdb_handler.py 69% 🟢
backend/tasks/manual/cleanup_orphaned_resources.py 27% 🟢
backend/tasks/scheduled/scan_library.py 89% 🟢
backend/tasks/scheduled/update_launchbox_metadata.py 98% 🟢
backend/tasks/scheduled/update_switch_titledb.py 100% 🟢
backend/tasks/tasks.py 100% 🟢
TOTAL 65% 🟢

updated for commit: a6d078d by action🐍

@gantoine gantoine changed the title Replace MessageResponse with spcific responses Replace MessageResponse with specific responses Aug 2, 2025
@gantoine gantoine requested a review from Copilot August 2, 2025 19:26
Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the generic MessageResponse type with specific response types throughout the API. The main goals are to improve type safety and provide more meaningful response data for various operations.

Key changes include:

  • Removal of generic MessageResponse in favor of specific response types like TaskExecutionResponse, TaskStatusResponse, and BulkOperationResponse
  • Addition of a new task API module with proper response typing
  • Conversion of several endpoints to return None for operations that don't need response data
  • Hardcoded success messages in frontend components instead of relying on API responses

Reviewed Changes

Copilot reviewed 49 out of 54 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
frontend/src/services/api/user.ts Updated return types and removed MessageResponse imports
frontend/src/services/api/task.ts New task API module with typed responses
frontend/src/services/api/rom.ts Changed deleteRoms to return BulkOperationResponse
frontend/src/services/api/platform.ts Removed MessageResponse return type
frontend/src/services/api/identity.ts Removed MessageResponse return types
frontend/src/services/api/config.ts Removed MessageResponse return types
frontend/src/services/api/collection.ts Removed MessageResponse return types
frontend/src/components/common/Platform/Dialog/DeletePlatform.vue Hardcoded success message
frontend/src/components/common/Navigation/SettingsDrawer.vue Hardcoded logout success message
frontend/src/components/common/Game/Dialog/DeleteRom.vue Updated to use BulkOperationResponse data
frontend/src/components/common/Collection/Dialog/DeleteSmartCollection.vue Hardcoded success message
frontend/src/components/common/Collection/Dialog/DeleteCollection.vue Hardcoded success message
frontend/src/components/Settings/Administration/TaskOption.vue Updated to use new task API
backend/endpoints/user.py Changed delete_user and refresh_retro_achievements return types
backend/endpoints/tasks.py Major refactor to use specific response types
backend/endpoints/rom.py Updated deleteRoms to return BulkOperationResponse with error handling
backend/endpoints/platform.py Changed delete_platform to return None
backend/endpoints/firmware.py Updated delete_firmware to return BulkOperationResponse
backend/endpoints/configs.py Removed MessageResponse return types
backend/endpoints/collections.py Removed MessageResponse return types
backend/endpoints/auth.py Updated login/logout/password reset endpoints
backend/endpoints/responses/init.py Replaced MessageResponse with new response types
Files not reviewed (5)
  • frontend/src/generated/index.ts: Language not supported
  • frontend/src/generated/models/BulkOperationResponse.ts: Language not supported
  • frontend/src/generated/models/JobStatus.ts: Language not supported
  • frontend/src/generated/models/TaskExecutionResponse.ts: Language not supported
  • frontend/src/generated/models/TaskStatusResponse.ts: Language not supported

@gantoine gantoine marked this pull request as ready for review August 3, 2025 02:28
@gantoine gantoine removed the request for review from zurdi15 August 3, 2025 20:21
@gantoine gantoine merged commit f4a65c3 into master Aug 6, 2025
10 checks passed
@gantoine gantoine deleted the response-cleanup branch August 6, 2025 13:16
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