Skip to content

Commit

Permalink
reinstall app with previous config, config will carry over
Browse files Browse the repository at this point in the history
  • Loading branch information
polppol committed Nov 25, 2023
1 parent 687aca0 commit ec353c2
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,12 @@ const receiver = new ExpressReceiver({
logger.info(`Team ${mTeamId} is reinstall app with previous config, config will carry over.`)
installation.openPollConfig = team.openPollConfig;
}
if(team.hasOwnProperty('created_ts')) {
installation.created_ts = team.created_ts;
} else {
installation.created_ts = new Date();
}
installation.update_ts = new Date();
await orgCol.replaceOne(
{
$or: [
Expand All @@ -740,20 +746,10 @@ const receiver = new ExpressReceiver({
]
}, installation);
} else {
installation.created_ts = new Date();
await orgCol.insertOne(installation);
}

await orgCol.updateOne(
{
$or: [
{'team.id': mTeamId},
{'enterprise.id': mTeamId},
]
}
,
{ $set: { created_ts: new Date()} }
);

return mTeamId;
},
fetchInstallation: async (installQuery) => {
Expand Down

0 comments on commit ec353c2

Please sign in to comment.