zahmis 4 лет назад
Родитель
Сommit
4d0ef94e15
1 измененных файлов с 20 добавлено и 3 удалено
  1. 20 3
      packages/slackbot-proxy/src/controllers/slack.ts

+ 20 - 3
packages/slackbot-proxy/src/controllers/slack.ts

@@ -140,9 +140,10 @@ export class SlackCtrl {
     const installationId = authorizeResult.enterpriseId || authorizeResult.teamId;
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const installation = await this.installationRepository.findByTeamIdOrEnterpriseId(installationId!);
-    const relations = await this.relationMockRepository.createQueryBuilder('relation')
-      .where('relation.installationId = :id', { id: installation?.id })
-      .leftJoinAndSelect('relation.installation', 'installation')
+    // console.log(installation);
+    const relations = await this.relationMockRepository.createQueryBuilder('relation_mock')
+      .where('relation_mock.installationId = :id', { id: installation?.id })
+      .leftJoinAndSelect('relation_mock.installation', 'installation')
       .getMany();
 
     if (relations.length === 0) {
@@ -208,6 +209,22 @@ export class SlackCtrl {
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       const client = generateWebClient(botToken!);
 
+      // HARDCORD;
+      // const permittedChannelsForEachCommand = {
+      //   create: ['srv'],
+      //   search: ['srv', 'admin'],
+      // };
+
+      console.log('hoge');
+      // console.log(relations);
+      // const relationMock = await this.relationMockRepository.findOne({
+      //   where: { installation },
+      // });
+      // const permittedChannelsForEachCommand = relationMock?.permittedChannelsForEachCommand;
+      // console.log(relationMock);
+      // console.log(permittedChannelsForEachCommand);
+      console.log('hogedone');
+
       return client.chat.postEphemeral({
         text: 'Error occured.',
         channel: body.channel_id,