diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts deleted file mode 100644 index d22f389..0000000 --- a/src/app.controller.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { AppController } from './app.controller'; -import { AppService } from './app.service'; - -describe('AppController', () => { - let appController: AppController; - - beforeEach(async () => { - const app: TestingModule = await Test.createTestingModule({ - controllers: [AppController], - providers: [AppService], - }).compile(); - - appController = app.get(AppController); - }); - - describe('root', () => { - it('should return "Hello World!"', () => { - expect(appController.getHello()).toBe('Hello World!'); - }); - }); -}); diff --git a/src/app.module.ts b/src/app.module.ts deleted file mode 100644 index a7ae2d8..0000000 --- a/src/app.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Module } from '@nestjs/common'; -import { MyDiscordModule } from './frontends/discord/myDiscord.module'; -import { MySlackModule } from './frontends/slack/mySlack.module'; -import { AppController } from './app.controller'; - -@Module({ - imports: [MyDiscordModule, MySlackModule], - controllers: [AppController], -}) -export class AppModule {} diff --git a/src/frontends/discord/dto/textDto.ts b/src/interfaces/chat/discord/dto/textDto.ts similarity index 100% rename from src/frontends/discord/dto/textDto.ts rename to src/interfaces/chat/discord/dto/textDto.ts diff --git a/src/frontends/discord/myDiscord.module.ts b/src/interfaces/chat/discord/myDiscord.module.ts similarity index 82% rename from src/frontends/discord/myDiscord.module.ts rename to src/interfaces/chat/discord/myDiscord.module.ts index 3a8d68f..dfd4238 100644 --- a/src/frontends/discord/myDiscord.module.ts +++ b/src/interfaces/chat/discord/myDiscord.module.ts @@ -2,10 +2,10 @@ import { Logger, Module } from '@nestjs/common'; import { DiscordPingService } from './services/discordPing.service'; import { NecordModule } from 'necord'; import { DiscordChatService } from './services/discordChat.service'; -import { GcpModule } from '../../gcp/gcp.module'; +import { GcpModule } from '../../../shared/gcp/gcp.module'; import { NecordConfigService } from './services/necordConfig.service'; import { DiscordReadyLoggingService } from './services/discordReadyLogging.service'; -import { LangchainModule } from '../../ai/langchain/langchain/langchain.module'; +import { LangchainModule } from '../../../shared/ai/langchain/langchain/langchain.module'; @Module({ imports: [ diff --git a/src/frontends/discord/secrets/secrets.ts b/src/interfaces/chat/discord/secrets/secrets.ts similarity index 100% rename from src/frontends/discord/secrets/secrets.ts rename to src/interfaces/chat/discord/secrets/secrets.ts diff --git a/src/frontends/discord/services/discordChat.service.ts b/src/interfaces/chat/discord/services/discordChat.service.ts similarity index 89% rename from src/frontends/discord/services/discordChat.service.ts rename to src/interfaces/chat/discord/services/discordChat.service.ts index 261a15a..3c6abd8 100644 --- a/src/frontends/discord/services/discordChat.service.ts +++ b/src/interfaces/chat/discord/services/discordChat.service.ts @@ -1,10 +1,10 @@ import { Injectable, Logger } from '@nestjs/common'; import { Context, Options, SlashCommand, SlashCommandContext } from 'necord'; -import { DEV_GUILDS } from '../../../constants'; +import { DEV_GUILDS } from '../../../../shared/config/constants'; import { OpenAI } from 'langchain/llms/openai'; import { ChatPromptTemplate } from 'langchain/prompts'; import { TextDto } from '../dto/textDto'; -import { LlmModelService } from '../../../ai/langchain/langchain/llm-model/llm-model.controller'; +import { LlmModelService } from '../../../../shared/ai/langchain/langchain/llm-model/llm-model.controller'; @Injectable() export class DiscordChatService { diff --git a/src/frontends/discord/services/discordPing.service.ts b/src/interfaces/chat/discord/services/discordPing.service.ts similarity index 90% rename from src/frontends/discord/services/discordPing.service.ts rename to src/interfaces/chat/discord/services/discordPing.service.ts index e68d8d8..9d6a3aa 100644 --- a/src/frontends/discord/services/discordPing.service.ts +++ b/src/interfaces/chat/discord/services/discordPing.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { Context, SlashCommand, SlashCommandContext } from 'necord'; -import { DEV_GUILDS } from '../../../constants'; +import { DEV_GUILDS } from '../../../../shared/config/constants'; @Injectable() export class DiscordPingService { diff --git a/src/frontends/discord/services/discordReadyLogging.service.ts b/src/interfaces/chat/discord/services/discordReadyLogging.service.ts similarity index 100% rename from src/frontends/discord/services/discordReadyLogging.service.ts rename to src/interfaces/chat/discord/services/discordReadyLogging.service.ts diff --git a/src/frontends/discord/services/necordConfig.service.ts b/src/interfaces/chat/discord/services/necordConfig.service.ts similarity index 90% rename from src/frontends/discord/services/necordConfig.service.ts rename to src/interfaces/chat/discord/services/necordConfig.service.ts index 6f2aae1..0de0cf3 100644 --- a/src/frontends/discord/services/necordConfig.service.ts +++ b/src/interfaces/chat/discord/services/necordConfig.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { NecordModuleOptions } from 'necord'; import { IntentsBitField } from 'discord.js'; -import { SecretsManagerService } from '../../../gcp/secretsManager.service'; +import { SecretsManagerService } from '../../../../shared/gcp/secretsManager.service'; import { DISCORD_API_DEV_TOKEN, DISCORD_API_TOKEN } from '../secrets/secrets'; @Injectable() diff --git a/src/frontends/slack/createSlackModule.ts b/src/interfaces/chat/slack/createSlackModule.ts similarity index 100% rename from src/frontends/slack/createSlackModule.ts rename to src/interfaces/chat/slack/createSlackModule.ts diff --git a/src/frontends/slack/getSlackToken.ts b/src/interfaces/chat/slack/getSlackToken.ts similarity index 100% rename from src/frontends/slack/getSlackToken.ts rename to src/interfaces/chat/slack/getSlackToken.ts diff --git a/src/frontends/slack/mySlack.module.ts b/src/interfaces/chat/slack/mySlack.module.ts similarity index 82% rename from src/frontends/slack/mySlack.module.ts rename to src/interfaces/chat/slack/mySlack.module.ts index ce9fd8f..0a696af 100644 --- a/src/frontends/slack/mySlack.module.ts +++ b/src/interfaces/chat/slack/mySlack.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { GcpModule } from '../../gcp/gcp.module'; +import { GcpModule } from '../../../shared/gcp/gcp.module'; import { SlackTestService } from './slackTest.service'; import { createSlackModule } from './createSlackModule'; diff --git a/src/frontends/slack/slackTest.service.ts b/src/interfaces/chat/slack/slackTest.service.ts similarity index 100% rename from src/frontends/slack/slackTest.service.ts rename to src/interfaces/chat/slack/slackTest.service.ts diff --git a/src/main.ts b/src/main.ts index 8a82201..cad43af 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,13 +1,9 @@ import { NestFactory } from '@nestjs/core'; -import { AppModule } from './app.module'; -import { SlackTestService } from './frontends/slack/slackTest.service'; +import { MainModule } from './main/main.module'; async function bootstrap() { - const app = await NestFactory.create(AppModule); - const sts = await app.resolve(SlackTestService); - sts.helloWorldMethod(); - + const app = await NestFactory.create(MainModule); await app.listen(process.env.PORT || 3000); } -bootstrap(); +void bootstrap(); diff --git a/src/main/main.controller.spec.ts b/src/main/main.controller.spec.ts new file mode 100644 index 0000000..4dd0f33 --- /dev/null +++ b/src/main/main.controller.spec.ts @@ -0,0 +1,21 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { MainController } from './main.controller'; + +describe('AppController', () => { + let appController: MainController; + + beforeEach(async () => { + const app: TestingModule = await Test.createTestingModule({ + controllers: [MainController], + providers: [], + }).compile(); + + appController = app.get(MainController); + }); + + describe('root', () => { + it('should return "Hello World!"', () => { + expect(appController.sendHello()).toBe('Hello World!'); + }); + }); +}); diff --git a/src/app.controller.ts b/src/main/main.controller.ts similarity index 77% rename from src/app.controller.ts rename to src/main/main.controller.ts index cf3ebc7..f4d2ba8 100644 --- a/src/app.controller.ts +++ b/src/main/main.controller.ts @@ -1,9 +1,9 @@ import { Controller, Get } from '@nestjs/common'; @Controller() -export class AppController { +export class MainController { @Get() - getHello() { + sendHello() { return 'hello'; } diff --git a/src/main/main.module.ts b/src/main/main.module.ts new file mode 100644 index 0000000..eeb69ae --- /dev/null +++ b/src/main/main.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { MyDiscordModule } from '../interfaces/chat/discord/myDiscord.module'; +import { MySlackModule } from '../interfaces/chat/slack/mySlack.module'; +import { MainController } from './main.controller'; + +@Module({ + imports: [MyDiscordModule, MySlackModule], + controllers: [MainController], +}) +export class MainModule {} diff --git a/src/ai/langchain/langchain/langchain.module.ts b/src/shared/ai/langchain/langchain/langchain.module.ts similarity index 100% rename from src/ai/langchain/langchain/langchain.module.ts rename to src/shared/ai/langchain/langchain/langchain.module.ts diff --git a/src/ai/langchain/langchain/llm-model/llm-model.controller.ts b/src/shared/ai/langchain/langchain/llm-model/llm-model.controller.ts similarity index 100% rename from src/ai/langchain/langchain/llm-model/llm-model.controller.ts rename to src/shared/ai/langchain/langchain/llm-model/llm-model.controller.ts diff --git a/src/ai/langchain/langchain/llm-model/llm-model.service.spec.ts b/src/shared/ai/langchain/langchain/llm-model/llm-model.service.spec.ts similarity index 100% rename from src/ai/langchain/langchain/llm-model/llm-model.service.spec.ts rename to src/shared/ai/langchain/langchain/llm-model/llm-model.service.spec.ts diff --git a/src/ai/langchain/langchain/llm-model/llm-model.service.ts b/src/shared/ai/langchain/langchain/llm-model/llm-model.service.ts similarity index 100% rename from src/ai/langchain/langchain/llm-model/llm-model.service.ts rename to src/shared/ai/langchain/langchain/llm-model/llm-model.service.ts diff --git a/src/ai/langchain/langchain/openAiSecrets.service.ts b/src/shared/ai/langchain/langchain/openAiSecrets.service.ts similarity index 100% rename from src/ai/langchain/langchain/openAiSecrets.service.ts rename to src/shared/ai/langchain/langchain/openAiSecrets.service.ts diff --git a/src/constants.ts b/src/shared/config/constants.ts similarity index 100% rename from src/constants.ts rename to src/shared/config/constants.ts diff --git a/src/gcp/gcp.module.ts b/src/shared/gcp/gcp.module.ts similarity index 100% rename from src/gcp/gcp.module.ts rename to src/shared/gcp/gcp.module.ts diff --git a/src/gcp/secretsManager.service.ts b/src/shared/gcp/secretsManager.service.ts similarity index 100% rename from src/gcp/secretsManager.service.ts rename to src/shared/gcp/secretsManager.service.ts diff --git a/test/app.e2e-spec.ts b/test/app.e2e-spec.ts index 50cda62..bfa49d8 100644 --- a/test/app.e2e-spec.ts +++ b/test/app.e2e-spec.ts @@ -1,14 +1,14 @@ import { Test, TestingModule } from '@nestjs/testing'; import { INestApplication } from '@nestjs/common'; import * as request from 'supertest'; -import { AppModule } from './../src/app.module'; +import { MainModule } from '../src/main/main.module'; -describe('AppController (e2e)', () => { +describe('MainController (e2e)', () => { let app: INestApplication; beforeEach(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule], + imports: [MainModule], }).compile(); app = moduleFixture.createNestApplication();