Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/src/reports/reports.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ export class ReportsService {

const command = new UpdateItemCommand({
TableName: this.tableName,
Key: marshall({ id }),
Key: marshall({
userId, // Partition key
id, // Sort key
}),
UpdateExpression: 'SET #status = :status, updatedAt = :updatedAt',
ConditionExpression: 'userId = :userId', // Ensure the report belongs to the user
ExpressionAttributeNames: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/common/api/__tests__/reportService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ vi.mock('../reportService', async (importOriginal) => {
// Mock markReportAsRead to avoid the dependency on getAuthConfig
markReportAsRead: async (reportId: string) => {
try {
const response = await axios.patch(`/api/reports/${reportId}`, {
const response = await axios.patch(`/api/reports/${reportId}/status`, {
status: 'READ',
});
return response.data;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/common/api/reportService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const fetchAllReports = async (): Promise<MedicalReport[]> => {
export const markReportAsRead = async (reportId: string): Promise<MedicalReport> => {
try {
const response = await axios.patch(
`${API_URL}/api/reports/${reportId}`,
`${API_URL}/api/reports/${reportId}/status`,
{
status: 'READ',
},
Expand Down