Skip to content

Commit f1d5ff2

Browse files
committed
Update ReportsService to include userId in report update key
- 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.
1 parent f9891da commit f1d5ff2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backend/src/reports/reports.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ export class ReportsService {
243243

244244
const command = new UpdateItemCommand({
245245
TableName: this.tableName,
246-
Key: marshall({ id }),
246+
Key: marshall({
247+
userId, // Partition key
248+
id, // Sort key
249+
}),
247250
UpdateExpression: 'SET #status = :status, updatedAt = :updatedAt',
248251
ConditionExpression: 'userId = :userId', // Ensure the report belongs to the user
249252
ExpressionAttributeNames: {

0 commit comments

Comments
 (0)