refs #4823 Añadido modulo colors y modif. readme

This commit is contained in:
Guillermo Bonet 2023-03-13 14:56:39 +01:00
parent 9acb656501
commit c57916815d
4 changed files with 729 additions and 256 deletions

View File

@ -78,16 +78,16 @@ npm dev-sync # run and create the db structure
### .env file
```bash
# FLORIDAY SERVICE CONFIG
CLIENT_ID = floriday-client_id
CLIENT_SECRET = floriday-client_secret
STATUS = production_or_development
# SEQUELIZE CONFIG
DB_SCHEMA = edi
DB_USER = root
DB_PWD = root
DB_HOST = localhost
DB_DIALECT = mariadb
FORCE_SYNC = false
```

976
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@
},
"dependencies": {
"cli-progress": "^3.11.2",
"colors": "^1.4.0",
"dotenv": "^16.0.3",
"mariadb": "^3.0.2",
"moment": "^2.29.4",

View File

@ -3,6 +3,7 @@ import fetch from 'node-fetch';
import dotenv from 'dotenv';
import { models } from './models/index.js';
import { v4 as uuidv4 } from 'uuid';
import colors from 'colors';
//import cliProgress from 'cli-progress';
dotenv.config();
@ -21,6 +22,9 @@ const BASE_CUSTOMER_URL = 'https://api.staging.floriday.io/customers-api/2022v2/
*/
async function getClientToken() {
const clientConfigData = await models.clientConfig.findAll();
if (!clientConfigData[0])
throw colors.red.bold('Token has expired')
const now = moment().format('YYYY-MM-DD HH:mm:ss');
const tokenExpirationDate = clientConfigData[0].tokenExpiration;