itizawa 5 лет назад
Родитель
Сommit
91b3dd153d

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

@@ -67,12 +67,16 @@ export class SlackCtrl {
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events
     res.send();
 
+    const installation = await this.installationRepository.findByID('1');
+    if (installation == null) {
+      throw new Error('installation is reqiured');
+    }
+
     console.log('body', body);
     const teamId = body.team_id;
 
     // TODO move to service
-    const order = await this.orderRepository.findOrCreateByTeamId(teamId);
-    console.log('order', order);
+    // console.log('order', order);
 
     return 'This action will be handled by bolt service.';
   }

+ 0 - 10
packages/slackbot-proxy/src/repositories/order.ts

@@ -7,14 +7,4 @@ import { Order } from '~/entities/order';
 @EntityRepository(Order)
 export class OrderRepository extends Repository<Order> {
 
-  async findOrCreateByTeamId(teamId:string):Promise<Order> {
-    const order = await this.findOne({ teamId });
-
-    if (order == null) {
-      return this.save({ teamId });
-    }
-
-    return order;
-  }
-
 }