Go to file
Guillermo Bonet 2a195194b2 refs #4823 Added new function vnRequest 2023-05-12 09:13:03 +02:00
.vscode apply linter and add useful comments to the util.js functions 2023-01-09 13:35:05 +01:00
models refs #4823 Added new env DB_TIMEZONE, and bugs fix 2023-05-11 14:36:55 +02:00
.eslintrc.cjs added linter to the project 2023-01-09 11:59:07 +01:00
.gitignore add env variables support 2023-01-09 10:06:34 +01:00
README.md refs #4823 Added new function vnRequest 2023-05-12 09:13:03 +02:00
floriday.js refs #4823 Added new env DB_TIMEZONE, and bugs fix 2023-05-11 14:36:55 +02:00
main.js refs #4823 Changes in structure 2023-04-06 10:56:52 +02:00
package-lock.json refs #4823 Reeplaced node-fetch to axios 2023-05-11 08:39:02 +02:00
package.json refs #4823 Reeplaced node-fetch to axios 2023-05-11 08:39:02 +02:00
utils.js refs #4823 Added new function vnRequest 2023-05-12 09:13:03 +02:00

README.md

Floriday

The Floriday service project should perform the following tasks:

  1. Create / mantain the table structure to allow the storage of the data provided by the Floriday API. This is done using the Sequelize ORM.
  2. Query the Floriday API and store the data in the database. This is done using the axios package.
    2.1. The data is requested every minute, but only the data that has changed is stored in the database. This is done using the Sequelize ORM and storing the data as it is received from the API, so it can be compared with the previous data.

Requeriments

  • Git
  • Nodejs (v15.14.0 or higher)

Installation

Pull from repository.

Run this commands on project root directory to install Node dependencies.

npm i

.env file template

#FLORIDAY DATA CONFIG
CLIENT_ID = xxxxxxxxxx
CLIENT_SECRET = xxxxxxxxxx
API_KEY = xxxxxxxxxx
API_URL = https://api.staging.floriday.io/customers-api-2023v1
API_ENDPOINT = https://idm.staging.floriday.io/oauth2/ausmw6b47z1BnlHkw0h7/v1/token

#SEQUELIZE CONFIG
DB_SCHEMA = schema
DB_USER = root
DB_PWD = root
DB_HOST = localhost
DB_DIALECT = mariadb
DB_TIMEOUT_RECONECT = 30000
DB_MAX_CONN_POOL = 40
DB_TIMEZONE = Europe/Madrid

#GENERAL CONFIG
IS_PRODUCTION = false
MS_PRODUCTION_SCHEDULE = 300000
MS_TEST_SCHEDULE = 100000
SECRETS = true
FORCE_SYNC = true
SYNC_SEQUENCE = true
SYNC_SUPPLIER = true
SYNC_CONN = true
SYNC_TRADEITEM = true
MAX_REQUEST_RETRIES = 3

Guidelines

  • In case a new model is created, it should follow the following structure:

  • /models

    • main.js
    • foo.js

Foo.js

import { Sequelize } from 'sequelize';

const bar = {
  barCharacteristicOne: {
    type: Sequelize.INTEGER,
  },
  barCharacteristicTwo: {
    type: Sequelize.STRING,
  },
  barCharacteristicThree: {
    type: Sequelize.STRING,
  },
};

export default (sequelize) => {
  const Foo = sequelize.define(
    "foo",
    bar,
    {
      timestamps: false,
      freezeTableName: true,
    }
  );
  return Foo;
};

main.js

import foo from "./foo";

let models = {
   bar: foo(sequelize),
}; 

Built With