zahmis 4 lat temu
rodzic
commit
697bfc6fc9

+ 0 - 18
packages/slackbot-proxy/src/controllers/growi-to-slack.ts

@@ -52,8 +52,6 @@ export class GrowiToSlackCtrl {
   sectionBlockPayloadDelegator: SectionBlockPayloadDelegator;
   sectionBlockPayloadDelegator: SectionBlockPayloadDelegator;
 
 
   async requestToGrowi(growiUrl:string, tokenPtoG:string):Promise<void> {
   async requestToGrowi(growiUrl:string, tokenPtoG:string):Promise<void> {
-    console.log(55);
-
     const url = new URL('/_api/v3/slack-integration/proxied/commands', growiUrl);
     const url = new URL('/_api/v3/slack-integration/proxied/commands', growiUrl);
     await axios.post(url.toString(), {
     await axios.post(url.toString(), {
       type: 'url_verification',
       type: 'url_verification',
@@ -123,8 +121,6 @@ export class GrowiToSlackCtrl {
   @Post('/relation-test')
   @Post('/relation-test')
   @UseBefore(verifyGrowiToSlackRequest)
   @UseBefore(verifyGrowiToSlackRequest)
   async postRelation(@Req() req: GrowiReq, @Res() res: Res): Promise<void|string|Res|WebAPICallResult> {
   async postRelation(@Req() req: GrowiReq, @Res() res: Res): Promise<void|string|Res|WebAPICallResult> {
-    console.log(126);
-
     const { tokenGtoPs } = req;
     const { tokenGtoPs } = req;
 
 
     if (tokenGtoPs.length !== 1) {
     if (tokenGtoPs.length !== 1) {
@@ -134,22 +130,16 @@ export class GrowiToSlackCtrl {
     const tokenGtoP = tokenGtoPs[0];
     const tokenGtoP = tokenGtoPs[0];
 
 
     // retrieve relation with Installation
     // retrieve relation with Installation
-    console.log(tokenGtoP, 133);
-
     const relation = await this.relationRepository.createQueryBuilder('relation')
     const relation = await this.relationRepository.createQueryBuilder('relation')
       .where('tokenGtoP = :token', { token: tokenGtoP })
       .where('tokenGtoP = :token', { token: tokenGtoP })
       .leftJoinAndSelect('relation.installation', 'installation')
       .leftJoinAndSelect('relation.installation', 'installation')
       .getOne();
       .getOne();
 
 
-    console.log(138, relation);
-
     // Returns the result of the test if it already exists
     // Returns the result of the test if it already exists
     if (relation != null) {
     if (relation != null) {
       logger.debug('relation found', relation);
       logger.debug('relation found', relation);
 
 
       const token = relation.installation.data.bot?.token;
       const token = relation.installation.data.bot?.token;
-      console.log(token, 145);
-
       if (token == null) {
       if (token == null) {
         throw createError(400, 'installation is invalid');
         throw createError(400, 'installation is invalid');
       }
       }
@@ -158,12 +148,9 @@ export class GrowiToSlackCtrl {
         await this.requestToGrowi(relation.growiUri, relation.tokenPtoG);
         await this.requestToGrowi(relation.growiUri, relation.tokenPtoG);
       }
       }
       catch (err) {
       catch (err) {
-        console.log(157);
-
         logger.error(err);
         logger.error(err);
         throw createError(400, `failed to request to GROWI. err: ${err.message}`);
         throw createError(400, `failed to request to GROWI. err: ${err.message}`);
       }
       }
-      console.log(162);
 
 
       const status = await getConnectionStatus(token);
       const status = await getConnectionStatus(token);
 
 
@@ -181,9 +168,6 @@ export class GrowiToSlackCtrl {
       .leftJoinAndSelect('order.installation', 'installation')
       .leftJoinAndSelect('order.installation', 'installation')
       .getOne();
       .getOne();
 
 
-    console.log(order);// 存在する
-
-
     if (order == null || order.isExpired()) {
     if (order == null || order.isExpired()) {
       throw createError(400, 'order has expired or does not exist.');
       throw createError(400, 'order has expired or does not exist.');
     }
     }
@@ -193,8 +177,6 @@ export class GrowiToSlackCtrl {
       await this.requestToGrowi(order.growiUrl, order.tokenPtoG);
       await this.requestToGrowi(order.growiUrl, order.tokenPtoG);
     }
     }
     catch (err) {
     catch (err) {
-      console.log(192, err);
-
       logger.error(err);
       logger.error(err);
       throw createError(400, `failed to request to GROWI. err: ${err.message}`);
       throw createError(400, `failed to request to GROWI. err: ${err.message}`);
     }
     }