fix(conversations): exclude DELETED conversations from evolution queries and user operations
- findForEvolution() now excludes DELETED conversations (should not learn from deleted data) - getConversation() rejects DELETED conversations for user-facing operations (sendMessage, getMessages, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d083008001
commit
8d8df53e56
|
|
@ -60,7 +60,8 @@ export class ConversationPostgresRepository
|
||||||
hoursBack?: number;
|
hoursBack?: number;
|
||||||
minMessageCount?: number;
|
minMessageCount?: number;
|
||||||
}): Promise<ConversationEntity[]> {
|
}): Promise<ConversationEntity[]> {
|
||||||
const queryBuilder = this.createTenantQueryBuilder('conversation');
|
const queryBuilder = this.createTenantQueryBuilder('conversation')
|
||||||
|
.andWhere('conversation.status != :deletedStatus', { deletedStatus: 'DELETED' });
|
||||||
|
|
||||||
if (options.status) {
|
if (options.status) {
|
||||||
queryBuilder.andWhere('conversation.status = :status', { status: options.status });
|
queryBuilder.andWhere('conversation.status = :status', { status: options.status });
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export class ConversationService {
|
||||||
): Promise<ConversationEntity> {
|
): Promise<ConversationEntity> {
|
||||||
const conversation = await this.conversationRepo.findById(conversationId);
|
const conversation = await this.conversationRepo.findById(conversationId);
|
||||||
|
|
||||||
if (!conversation || conversation.userId !== userId) {
|
if (!conversation || conversation.userId !== userId || conversation.isDeleted()) {
|
||||||
throw new NotFoundException('Conversation not found');
|
throw new NotFoundException('Conversation not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue