Skip to content

Conversation

@adamrefaey
Copy link
Collaborator

@adamrefaey adamrefaey commented Apr 25, 2025

Change

This pull request includes updates to the ReportsService in the backend and changes to the API endpoints and their usage in the frontend. The most important changes involve modifying the DynamoDB key structure in the backend and updating the API endpoint for marking reports as read in the frontend.

Backend changes:

  • Updated the ReportsService in reports.service.ts to use a composite key (userId as the partition key and id as the sort key) for DynamoDB operations, ensuring better data organization and query flexibility.

Frontend changes:

  • Updated the API endpoint for marking reports as read by appending /status to the URL in reportService.test.ts and reportService.ts, aligning it with the new backend API structure. [1] [2]

Does this PR introduce a breaking change?

{...}

What needs to be documented once your changes are merged?

{...}

Additional Comments

{...}

- Changed the API endpoint for marking a report as read from `/api/reports/${reportId}` to `/api/reports/${reportId}/status` in both the reportService and its corresponding test file.
- This change improves clarity in the API structure.
@adamrefaey adamrefaey requested review from GuidoBR and Copilot April 25, 2025 16:27
@adamrefaey adamrefaey self-assigned this Apr 25, 2025

This comment was marked as outdated.

- Modified the UpdateItemCommand in ReportsService to use both userId and id as keys for report updates. This change ensures that the report belongs to the correct user, enhancing data integrity.
@adamrefaey adamrefaey requested a review from Copilot April 25, 2025 16:34
Copy link
Contributor

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 updates the API endpoint for marking a report as read to improve clarity, and accordingly updates both the frontend service and its tests. Additionally, the backend service is refactored to use a composite key when updating report status.

  • Updated API endpoint in reportService.ts to include "/status".
  • Updated the corresponding test file to match the new endpoint.
  • Refactored the backend update command to use a composite key including userId and id.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
frontend/src/common/api/reportService.ts Updated the endpoint for marking a report as read in the frontend.
frontend/src/common/api/tests/reportService.test.ts Updated the API endpoint in tests to match the new structure.
backend/src/reports/reports.service.ts Modified the update command to use a composite key (userId and id).
Comments suppressed due to low confidence (1)

backend/src/reports/reports.service.ts:247

  • The update command now expects a composite key including 'userId', but it is unclear if 'userId' is properly defined and scoped in this context. Please ensure that 'userId' is initialized and accessible when constructing the key.
userId, // Partition key

@GuidoBR GuidoBR merged commit 7b9ddb1 into main Apr 25, 2025
2 checks passed
@adamrefaey adamrefaey deleted the NO-TICKET-FIX-MARK-AS-READ-STATUS branch April 25, 2025 17:19
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.

3 participants