refs #4823 Changed API_URL to new version

This commit is contained in:
Guillermo Bonet 2023-04-25 08:09:52 +02:00
parent 090c050729
commit 355912fc57
3 changed files with 7 additions and 14 deletions

View File

@ -32,7 +32,7 @@ npm i
CLIENT_ID = xxxxxxxxxx
CLIENT_SECRET = xxxxxxxxxx
API_KEY = xxxxxxxxxx
API_URL = https://api.staging.floriday.io/customers-api/2022v2
API_URL = https://api.staging.floriday.io/customers-api-2023v1
API_ENDPOINT = https://idm.staging.floriday.io/oauth2/ausmw6b47z1BnlHkw0h7/v1/token
#SEQUELIZE CONFIG

View File

@ -43,12 +43,6 @@ const suppliers = {
physicalAddress: {
type: Sequelize.JSON,
},
pythosanitaryNumber: {
type: Sequelize.STRING,
},
organizationType: {
type: Sequelize.STRING,
},
isConnected: {
type: Sequelize.BOOLEAN,
defaultValue: false,

View File

@ -4,6 +4,7 @@ import { models } from './models/index.js';
import { v4 as uuidv4 } from 'uuid';
import chalk from 'chalk';
import ora from 'ora';
const env = process.env;
/**
* Gets the Access Token from the client config table
@ -238,12 +239,12 @@ export async function syncSuppliers(){
let headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${await getCurrentToken()}`,
'X-Api-Key': process.env.API_KEY
'X-Api-Key': process.env.API_KEY,
};
const response = await fetch(`${env.API_URL}/organizations/current-max-sequence`, {
method: 'GET',
headers
headers,
});
if (!response.ok) {
@ -283,10 +284,8 @@ export async function syncSuppliers(){
endDate: supplier.endDate,
mailingAddress: supplier.mailingAddress,
physicalAddress: supplier.physicalAddress,
pythosanitaryNumber: supplier.pythosanitaryNumber,
organizationType: supplier.organizationType
});
}
};
await syncSequence(curSequenceNumber, 'suppliers', maxSequenceNumber);
timeFinish = new moment();
timeToGoSec = (timeFinish.diff(timeStart, 'seconds') * (maxSequenceNumber - curSequenceNumber) / 1000)