|
@@ -26,9 +26,6 @@ import { SectionBlockPayloadDelegator } from '~/services/growi-uri-injector/Sect
|
|
|
|
|
|
|
|
const logger = loggerFactory('slackbot-proxy:controllers:growi-to-slack');
|
|
const logger = loggerFactory('slackbot-proxy:controllers:growi-to-slack');
|
|
|
|
|
|
|
|
-// temporarily save for selection to growi
|
|
|
|
|
-const temporarySinglePostCommands = ['create'];
|
|
|
|
|
-
|
|
|
|
|
@Controller('/g2s')
|
|
@Controller('/g2s')
|
|
|
export class GrowiToSlackCtrl {
|
|
export class GrowiToSlackCtrl {
|
|
|
|
|
|
|
@@ -170,6 +167,10 @@ export class GrowiToSlackCtrl {
|
|
|
|
|
|
|
|
logger.debug('relation test is success', order);
|
|
logger.debug('relation test is success', order);
|
|
|
|
|
|
|
|
|
|
+ // temporary cache for 48 hours
|
|
|
|
|
+ const now = new Date();
|
|
|
|
|
+ const expiredAtCommands = new Date(now.setHours(now.getHours() + 48));
|
|
|
|
|
+
|
|
|
// Transaction is not considered because it is used infrequently,
|
|
// Transaction is not considered because it is used infrequently,
|
|
|
const response = await this.relationRepository.createQueryBuilder('relation')
|
|
const response = await this.relationRepository.createQueryBuilder('relation')
|
|
|
.insert()
|
|
.insert()
|
|
@@ -178,10 +179,12 @@ export class GrowiToSlackCtrl {
|
|
|
tokenGtoP: order.tokenGtoP,
|
|
tokenGtoP: order.tokenGtoP,
|
|
|
tokenPtoG: order.tokenPtoG,
|
|
tokenPtoG: order.tokenPtoG,
|
|
|
growiUri: order.growiUrl,
|
|
growiUri: order.growiUrl,
|
|
|
- siglePostCommands: temporarySinglePostCommands,
|
|
|
|
|
|
|
+ broadcastCommands: req.body.broadcastCommands,
|
|
|
|
|
+ singlePostCommands: req.body.singlePostCommands,
|
|
|
|
|
+ expiredAtCommands,
|
|
|
})
|
|
})
|
|
|
// https://github.com/typeorm/typeorm/issues/1090#issuecomment-634391487
|
|
// https://github.com/typeorm/typeorm/issues/1090#issuecomment-634391487
|
|
|
- .orUpdate({ conflict_target: ['installation', 'growiUri'], overwrite: ['tokenGtoP', 'tokenPtoG', 'siglePostCommands'] })
|
|
|
|
|
|
|
+ .orUpdate({ conflict_target: ['installation', 'growiUri'], overwrite: ['tokenGtoP', 'tokenPtoG', 'broadcastCommands', 'singlePostCommands'] })
|
|
|
.execute();
|
|
.execute();
|
|
|
|
|
|
|
|
// Find the generated relation
|
|
// Find the generated relation
|