fix(memory): scope InsightsRepo operations to userId — M2-001/002 (#290)

Co-authored-by: Jason Woltje <[email protected]>
Co-committed-by: Jason Woltje <[email protected]>
This commit is contained in:
2026-03-21 20:34:42 +00:00
committed by jason.woltje
parent ebf99d9ff7
commit 05a805eeca
3 changed files with 47 additions and 12 deletions
+4 -4
View File
@@ -73,8 +73,8 @@ export class MemoryController {
}
@Get('insights/:id')
async getInsight(@Param('id') id: string) {
const insight = await this.memory.insights.findById(id);
async getInsight(@CurrentUser() user: { id: string }, @Param('id') id: string) {
const insight = await this.memory.insights.findById(id, user.id);
if (!insight) throw new NotFoundException('Insight not found');
return insight;
}
@@ -97,8 +97,8 @@ export class MemoryController {
@Delete('insights/:id')
@HttpCode(HttpStatus.NO_CONTENT)
async removeInsight(@Param('id') id: string) {
const deleted = await this.memory.insights.remove(id);
async removeInsight(@CurrentUser() user: { id: string }, @Param('id') id: string) {
const deleted = await this.memory.insights.remove(id, user.id);
if (!deleted) throw new NotFoundException('Insight not found');
}