refactor-syncsuppliers #1

Merged
pau merged 3 commits from refactor-syncsuppliers into master 2023-02-07 13:46:21 +00:00
1 changed files with 7 additions and 11 deletions
Showing only changes of commit 1cb0d06282 - Show all commits

View File

@ -81,17 +81,13 @@ async function getClientToken() {
async function updateClientConfig(clientId, clientSecret, accessToken, tokenExpirationDate) { async function updateClientConfig(clientId, clientSecret, accessToken, tokenExpirationDate) {
try { try {
console.log('Updating the client config with the new token...'); console.log('Updating the client config with the new token...');
await models.clientConfig.findOrCreate({ await models.clientConfig.upsert({
where: { id: 1,
id: 1, clientId: clientId,
}, clientSecret: clientSecret,
defaults: { currentToken: accessToken,
clientId: clientId, tokenExpiration: tokenExpirationDate,
clientSecret: clientSecret, requestLimit: 500,
currentToken: accessToken,
tokenExpiration: tokenExpirationDate,
requestLimit: 500,
},
}); });
console.log('Client config updated, new Token set'); console.log('Client config updated, new Token set');
console.log('New token expiration date: ', tokenExpirationDate); console.log('New token expiration date: ', tokenExpirationDate);