zahmis 4 лет назад
Родитель
Сommit
9f492e3451

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

@@ -173,9 +173,9 @@ export class SlackCtrl {
     const relationsForSingleUse:RelationMock[] = [];
     await Promise.all(relations.map(async(relation) => {
       const isSupported = await this.relationsService.isSupportedGrowiCommandForSingleUse(relation, growiCommand.growiCommandType, baseDate);
-      if (isSupported) {
-        return relationsForSingleUse.push(relation);
-      }
+      // if (isSupported) {
+      //   return relationsForSingleUse.push(relation);
+      // }
     }));
 
     let isCommandPermitted = false;
@@ -189,9 +189,9 @@ export class SlackCtrl {
     const relationsForBroadcastUse:RelationMock[] = [];
     await Promise.all(relations.map(async(relation) => {
       const isSupported = await this.relationsService.isSupportedGrowiCommandForBroadcastUse(relation, growiCommand.growiCommandType, baseDate);
-      if (isSupported) {
-        relationsForBroadcastUse.push(relation);
-      }
+      // if (isSupported) {
+      //   relationsForBroadcastUse.push(relation);
+      // }
     }));
 
     /*

+ 2 - 2
packages/slackbot-proxy/src/entities/relation-mock.ts

@@ -40,10 +40,10 @@ export class RelationMock {
   @Column()
   growiUri: string;
 
-  @Column('simple-array')
+  @Column({ type: 'json' })
   supportedCommandsForBroadcastUse: supportedCommandInterface;
 
-  @Column('simple-array')
+  @Column({ type: 'json' })
   supportedCommandsForSingleUse: supportedCommandInterface;
 
   @CreateDateColumn()

+ 10 - 6
packages/slackbot-proxy/src/services/RelationsService.ts

@@ -65,20 +65,24 @@ export class RelationsService {
     return relation;
   }
 
-  async isSupportedGrowiCommandForSingleUse(relation:RelationMock, growiCommandType:string, baseDate:Date):Promise<boolean> {
+  async isSupportedGrowiCommandForSingleUse(relation:RelationMock, growiCommandType:string, baseDate:Date):Promise<void> {
     const syncedRelation = await this.syncRelation(relation, baseDate);
     if (syncedRelation == null) {
-      return false;
+      // return false;
     }
-    return relation.supportedCommandsForSingleUse.includes(growiCommandType);
+    console.log(growiCommandType);
+    console.log(relation.supportedCommandsForSingleUse[growiCommandType], 73);
+    // return relation.supportedCommandsForSingleUse.includes(growiCommandType);
   }
 
-  async isSupportedGrowiCommandForBroadcastUse(relation:RelationMock, growiCommandType:string, baseDate:Date):Promise<boolean> {
+  async isSupportedGrowiCommandForBroadcastUse(relation:RelationMock, growiCommandType:string, baseDate:Date):Promise<void> {
     const syncedRelation = await this.syncRelation(relation, baseDate);
     if (syncedRelation == null) {
-      return false;
+      // return false;
     }
-    return relation.supportedCommandsForBroadcastUse.includes(growiCommandType);
+    console.log(relation.supportedCommandsForSingleUse);
+
+    // return relation.supportedCommandsForBroadcastUse.includes(growiCommandType);
   }
 
 }