refs #4823 New README and added .env_template
This commit is contained in:
parent
a6da4feb1f
commit
f8e950034a
|
@ -0,0 +1,32 @@
|
|||
#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_WAREHOUSE = true
|
||||
SYNC_CONN = true
|
||||
SYNC_TRADEITEM = true
|
||||
MAX_REQUEST_RETRIES = 3
|
||||
|
||||
#DEV OPTIONS
|
||||
SUPPLIERS_ALWAYS_CONN = false
|
112
README.md
112
README.md
|
@ -1,118 +1,38 @@
|
|||
# Floriday
|
||||
The project aims to develop an automated solution to retrieve and import Floramondo's offers into our system. Floramondo is a renowned platform for flower and plant commerce, offering a wide range of high-quality products. Our goal is to efficiently gather Floramondo's offers and seamlessly transfer the data to our system, preserving the original structure and format to facilitate future interpretation.
|
||||
|
||||
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](https://sequelize.org/) ORM.
|
||||
2. Query the Floriday API and store the data in the database.
|
||||
This is done using the [axios](https://www.npmjs.com/package/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](https://sequelize.org/) ORM and storing the data as it is received from the API,
|
||||
so it can be compared with the previous data.
|
||||
We turn flowers into data! :D
|
||||
|
||||
## Requeriments
|
||||
|
||||
* Git
|
||||
* Nodejs (v15.14.0 or higher)
|
||||
* Docker (Optional, used to manage local server)
|
||||
|
||||
## Installation
|
||||
|
||||
Pull from repository.
|
||||
```
|
||||
$ git clone https://gitea.verdnatura.es/guillermo/floriday.git
|
||||
```
|
||||
|
||||
Run this commands on project root directory to install Node dependencies.
|
||||
|
||||
```bash
|
||||
npm i
|
||||
```
|
||||
$ npm install
|
||||
```
|
||||
|
||||
### .env file template
|
||||
Copy *.env_template*, put the name *.env* and configure it.
|
||||
|
||||
```bash
|
||||
#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_WAREHOUSE = true
|
||||
SYNC_CONN = true
|
||||
SYNC_TRADEITEM = true
|
||||
MAX_REQUEST_RETRIES = 3
|
||||
|
||||
#DEV OPTIONS
|
||||
SUPPLIERS_ALWAYS_CONN = false
|
||||
## How to run
|
||||
Execute this command in project path.
|
||||
```
|
||||
|
||||
|
||||
## Guidelines
|
||||
|
||||
- In case a new model is created, it should follow the following structure:
|
||||
|
||||
- /models
|
||||
- main.js
|
||||
- foo.js
|
||||
|
||||
### Foo.js
|
||||
|
||||
```javascript
|
||||
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
|
||||
|
||||
```javascript
|
||||
import foo from "./foo";
|
||||
|
||||
let models = {
|
||||
bar: foo(sequelize),
|
||||
};
|
||||
|
||||
$ node main
|
||||
```
|
||||
|
||||
## Built With
|
||||
|
||||
* [nodejs](https://nodejs.org/)
|
||||
* [sequalize](https://sequelize.org/)
|
||||
* [Git](https://git-scm.com/)
|
||||
* [Nodejs](https://nodejs.org/)
|
||||
* [Sequalize](https://sequelize.org/)
|
||||
* [Docker](https://www.docker.com/)
|
Loading…
Reference in New Issue