Go to file
Guillermo Bonet cdd2fa269f refs #4823 Added floriday ascii 2023-04-04 15:04: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 floriday ascii 2023-04-04 15:04:03 +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 Añadido modulo colors y modif. readme 2023-03-13 14:56:39 +01:00
main.js #5446 Changes 2023-04-03 21:02:00 +02:00
package-lock.json #5446 Changes 2023-04-03 21:02:00 +02:00
package.json #5446 Changes 2023-04-03 21:02:00 +02:00
suppliersGln.js get all the suppliers from floriday api 2023-02-07 14:38:54 +01:00
test.json changes 2023-02-03 13:56:34 +01:00
utils.js #5446 Changes 2023-04-03 21:02:00 +02:00

README.md

Floriday

Requires Node.js v15.14.0 or higher.

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 node-fetch 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.

Guidelines

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

  • /models

    • index.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(
    "FDfoo",
    bar,
    {
      timestamps: false,
      freezeTableName: true,
    }
  );
  return Foo;
};

Index.js

import foo from "./foo";

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

To install dependencies:

npm install

To run:

npm start # run the service
npm dev-sync # run and create the db structure

.env file

# 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