Răsfoiți Sursa

take out growiCommandsMappings

zahmis 5 ani în urmă
părinte
comite
dbdaf96510
1 a modificat fișierele cu 23 adăugiri și 23 ștergeri
  1. 23 23
      packages/slackbot-proxy/src/controllers/slack.ts

+ 23 - 23
packages/slackbot-proxy/src/controllers/slack.ts

@@ -21,23 +21,27 @@ export class SlackCtrl {
   registerService: RegisterService
 
 
+   growiCommandsMappings = {
+     register: (body:{[key:string]:string}):Promise<void> => this.registerService.execSlashCommand(body),
+   };
+
   @Get('/testsave')
-  testsave(): void {
-    const installation = new Installation();
-    installation.data = {
-      team: undefined,
-      enterprise: undefined,
-      user: {
-        id: '',
-        token: undefined,
-        scopes: undefined,
-      },
-    };
-
-    // const installationRepository = getRepository(Installation);
-
-    this.installationRepository.save(installation);
-  }
+   testsave(): void {
+     const installation = new Installation();
+     installation.data = {
+       team: undefined,
+       enterprise: undefined,
+       user: {
+         id: '',
+         token: undefined,
+         scopes: undefined,
+       },
+     };
+
+     // const installationRepository = getRepository(Installation);
+
+     this.installationRepository.save(installation);
+   }
 
 
   @Get('/install')
@@ -66,13 +70,9 @@ export class SlackCtrl {
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
 
     const parsedBody = parse(body);
-
-    const growiCommandsMappings = {
-      register: () => this.registerService.execSlashCommand(body),
-    };
-    const executeGrowiCommand = growiCommandsMappings[parsedBody.growiCommandType];
-
-    await executeGrowiCommand();
+    const executeGrowiCommand = this.growiCommandsMappings[parsedBody.growiCommandType];
+    // console.log(executeGrowiCommand());
+    await executeGrowiCommand(body);
     res.send();
 
     return 'This action will be handled by bolt service.';