Add Smart Notes AI analysis and Mento Memory with user approval.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,7 +16,8 @@ import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { memoryStorage } from 'multer';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { CurrentUser } from '../auth/current-user.decorator';
|
||||
import { CreateNoteDto, ListNotesQueryDto, UpdateNoteDto } from './dto';
|
||||
import { CreateNoteDto, ListNotesQueryDto, UpdateNoteDto, ApplyNoteAiSuggestionDto } from './dto';
|
||||
import { NoteAiService } from './note-ai.service';
|
||||
import { NotesService } from './notes.service';
|
||||
|
||||
type AuthUser = { organizationId: string; userId: string; role: string };
|
||||
@@ -24,7 +25,10 @@ type AuthUser = { organizationId: string; userId: string; role: string };
|
||||
@Controller('notes')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class NotesController {
|
||||
constructor(private readonly notesService: NotesService) {}
|
||||
constructor(
|
||||
private readonly notesService: NotesService,
|
||||
private readonly noteAi: NoteAiService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
list(
|
||||
@@ -83,6 +87,30 @@ export class NotesController {
|
||||
);
|
||||
}
|
||||
|
||||
@Post(':id/analyze')
|
||||
analyze(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||
return this.noteAi.analyze(user.organizationId, id, user);
|
||||
}
|
||||
|
||||
@Get(':id/ai-suggestion')
|
||||
getAiSuggestion(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||
return this.noteAi.getSuggestion(user.organizationId, id, user);
|
||||
}
|
||||
|
||||
@Post(':id/ai-suggestion/apply')
|
||||
applyAiSuggestion(
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Param('id') id: string,
|
||||
@Body() dto: ApplyNoteAiSuggestionDto,
|
||||
) {
|
||||
return this.noteAi.apply(user.organizationId, user.userId, id, user, dto);
|
||||
}
|
||||
|
||||
@Post(':id/ai-suggestion/dismiss')
|
||||
dismissAiSuggestion(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||
return this.noteAi.dismiss(user.organizationId, id, user);
|
||||
}
|
||||
|
||||
@Post(':id/attachments')
|
||||
@UseInterceptors(
|
||||
FileInterceptor('file', {
|
||||
|
||||
Reference in New Issue
Block a user