Yuki Takei 5 лет назад
Родитель
Сommit
ba797f2f83

+ 2 - 6
packages/slackbot-proxy/src/Server.ts

@@ -22,7 +22,6 @@ const connectionOptions: ConnectionOptions = {
   username: process.env.TYPEORM_USERNAME,
   password: process.env.TYPEORM_PASSWORD,
   synchronize: true,
-  logging: true,
 } as ConnectionOptions;
 
 
@@ -87,11 +86,8 @@ export class Server {
   }
 
   async $onReady(): Promise<void> {
-    const typeormService = this.injector.get<TypeORMService>(TypeORMService);
-    console.log(typeormService);
-
-    const connection = typeormService?.connectionManager.get('default');
-    console.log(connection);
+    // for synchromizing when boot
+    this.injector.get<TypeORMService>(TypeORMService);
   }
 
 }

+ 3 - 9
packages/slackbot-proxy/src/services/InstallerService.ts

@@ -1,7 +1,7 @@
 import {
   Installation as SlackInstallation, InstallationQuery, InstallProvider,
 } from '@slack/oauth';
-import { Service } from '@tsed/di';
+import { Inject, Service } from '@tsed/di';
 
 import { Installation } from '~/entities/installation';
 import { InstallationRepository } from '~/repositories/installation';
@@ -11,12 +11,8 @@ export class InstallerService {
 
   installer: InstallProvider;
 
-  repository: InstallationRepository;
-
-  // eslint-disable-next-line no-useless-constructor
-  constructor(repository: InstallationRepository) {
-    this.repository = repository;
-  }
+  @Inject()
+  private readonly repository: InstallationRepository;
 
   $onInit(): Promise<any> | void {
     const clientId = process.env.SLACK_CLIENT_ID;
@@ -38,8 +34,6 @@ export class InstallerService {
       stateSecret,
       installationStore: {
         storeInstallation: async(slackInstallation: SlackInstallation<'v1' | 'v2', boolean>) => {
-          console.log({ slackInstallation });
-
           const installation = new Installation();
           installation.data = slackInstallation;