@fr-data-fabric/chatbot-api-nest 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fr-data-fabric/chatbot-api-nest",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json"
@@ -1,9 +1,4 @@
1
- import { ConversationEntity } from '@domain/entities/ConversationEntity';
2
1
  import { UserEntity } from '@domain/entities/UserEntity';
3
- import {
4
- CONVERSATION_REPOSITORY,
5
- ConversationRepository,
6
- } from '@domain/interfaces/ConversationRepository';
7
2
  import { SEND_CHAT_UC, SendChatUC } from '@domain/use-cases/chats/SendChatUC';
8
3
  import {
9
4
  CREATE_CONVERSATION_UC,
@@ -25,17 +20,13 @@ import { GetConversationsResolver } from '@inputs/resolvers/ConversationsResolve
25
20
  import { DynamicModule, Module, Type } from '@nestjs/common';
26
21
  import { GqlTypeReference } from '@nestjs/graphql';
27
22
 
28
- export type ChatbotApiModuleOptions<
29
- TUser extends UserEntity,
30
- TConversation extends ConversationEntity,
31
- > = {
23
+ export type ChatbotApiModuleOptions<TUser extends UserEntity> = {
32
24
  useCases: {
33
25
  getConversation: Type<IGetConversationUC<TUser>>;
34
26
  getConversations: Type<IGetConversationsUC<TUser>>;
35
27
  createConversation: Type<ICreateConversationUC<TUser>>;
36
28
  sendChat: Type<SendChatUC<never, TUser>>;
37
29
  };
38
- conversationRepository: Type<ConversationRepository<TConversation>>;
39
30
  gql: {
40
31
  GqlConversation: GqlTypeReference;
41
32
  GqlChat: GqlTypeReference;
@@ -48,18 +39,12 @@ export type ChatbotApiModuleOptions<
48
39
 
49
40
  @Module({})
50
41
  export class ChatbotApiModule {
51
- static register<
52
- TUser extends UserEntity,
53
- TConversation extends ConversationEntity,
54
- >(options: ChatbotApiModuleOptions<TUser, TConversation>): DynamicModule {
42
+ static register<TUser extends UserEntity>(
43
+ options: ChatbotApiModuleOptions<TUser>,
44
+ ): DynamicModule {
55
45
  return {
56
46
  module: ChatbotApiModule,
57
47
  providers: [
58
- // Repositories
59
- {
60
- provide: CONVERSATION_REPOSITORY,
61
- useClass: options.conversationRepository,
62
- },
63
48
  // Use cases
64
49
  {
65
50
  provide: GET_CONVERSATION_UC,
@@ -6,7 +6,7 @@ import {
6
6
  } from '@domain/use-cases/chats/SendChatUC';
7
7
  import { Body, Controller, Inject, Post, Res } from '@nestjs/common';
8
8
  import type { Response } from 'express';
9
- import { CurrentUserRest } from 'src/inputs/controllers/_common/CurrentUserRest';
9
+ import { CurrentUserRest } from './_common/CurrentUserRest';
10
10
 
11
11
  @Controller('chat')
12
12
  export class ChatsController {
@@ -33,8 +33,8 @@ import {
33
33
  ResolveField,
34
34
  Resolver,
35
35
  } from '@nestjs/graphql';
36
- import { CurrentUserGql } from 'src/inputs/resolvers/_common/CurrentUserGql';
37
- import { GqlPaginatedOutput } from 'src/inputs/resolvers/_common/GqlPaginatedOutput';
36
+ import { CurrentUserGql } from './_common/CurrentUserGql';
37
+ import { GqlPaginatedOutput } from './_common/GqlPaginatedOutput';
38
38
 
39
39
  export function GetConversationsResolver(
40
40
  GqlConversation: GqlTypeReference,