diff --git a/api/src/chat/controllers/context-var.controller.spec.ts b/api/src/chat/controllers/context-var.controller.spec.ts index 77aadde..a06eb4a 100644 --- a/api/src/chat/controllers/context-var.controller.spec.ts +++ b/api/src/chat/controllers/context-var.controller.spec.ts @@ -100,6 +100,7 @@ describe('ContextVarController', () => { const contextVarCreateDto: ContextVarCreateDto = { label: 'contextVarLabel2', name: 'test_add', + permanent: false, }; const result = await contextVarController.create(contextVarCreateDto); diff --git a/api/src/chat/dto/context-var.dto.ts b/api/src/chat/dto/context-var.dto.ts index 715efd8..3819f5c 100644 --- a/api/src/chat/dto/context-var.dto.ts +++ b/api/src/chat/dto/context-var.dto.ts @@ -20,6 +20,9 @@ export class ContextVarCreateDto { @IsNotEmpty() @IsString() name: string; + + @ApiProperty({ description: 'Is context var permanent', type: Boolean }) + permanent?: boolean; } export class ContextVarUpdateDto extends PartialType(ContextVarCreateDto) {} diff --git a/api/src/chat/services/bot.service.spec.ts b/api/src/chat/services/bot.service.spec.ts index 3625a1a..6f6f8f5 100644 --- a/api/src/chat/services/bot.service.spec.ts +++ b/api/src/chat/services/bot.service.spec.ts @@ -59,15 +59,18 @@ import { CategoryRepository } from './../repositories/category.repository'; import { BlockService } from './block.service'; import { BotService } from './bot.service'; import { CategoryService } from './category.service'; +import { ContextVarService } from './context-var.service'; import { ConversationService } from './conversation.service'; import { MessageService } from './message.service'; import { SubscriberService } from './subscriber.service'; import { BlockRepository } from '../repositories/block.repository'; +import { ContextVarRepository } from '../repositories/context-var.repository'; import { ConversationRepository } from '../repositories/conversation.repository'; import { MessageRepository } from '../repositories/message.repository'; import { SubscriberRepository } from '../repositories/subscriber.repository'; import { BlockFull, BlockModel } from '../schemas/block.schema'; import { CategoryModel } from '../schemas/category.schema'; +import { ContextVarModel } from '../schemas/context-var.schema'; import { Conversation, ConversationFull, @@ -107,6 +110,7 @@ describe('BlockService', () => { NlpEntityModel, NlpSampleEntityModel, NlpSampleModel, + ContextVarModel, ]), ], providers: [ @@ -143,6 +147,8 @@ describe('BlockService', () => { NlpSampleEntityService, NlpSampleService, NlpService, + ContextVarService, + ContextVarRepository, { provide: PluginService, useValue: {}, diff --git a/api/src/utils/test/fixtures/contextvar.ts b/api/src/utils/test/fixtures/contextvar.ts index a3ffc89..4ccea4b 100644 --- a/api/src/utils/test/fixtures/contextvar.ts +++ b/api/src/utils/test/fixtures/contextvar.ts @@ -18,10 +18,12 @@ const contextVars: ContextVarCreateDto[] = [ { label: 'test context var 1', name: 'test1', + permanent: false, }, { label: 'test context var 2', name: 'test2', + permanent: false, }, ]; diff --git a/api/src/utils/test/fixtures/subscriber.ts b/api/src/utils/test/fixtures/subscriber.ts index a45e41b..04aecd6 100644 --- a/api/src/utils/test/fixtures/subscriber.ts +++ b/api/src/utils/test/fixtures/subscriber.ts @@ -91,6 +91,9 @@ export const subscriberDefaultValues: TFixturesDefaultValues = { lastvisit: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), retainedFrom: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), avatar: null, + /*context: { + vars: {}, + }*/ // TODO: add unit tests taking into account the context field }; export const subscriberFixtures = getFixturesWithDefaultValues({