Added jsdoc to utils functions

This commit is contained in:
Pau 2023-01-11 14:37:46 +01:00
parent af1d804cb1
commit d9563dd343
2 changed files with 30 additions and 1 deletions

View File

@ -15,6 +15,26 @@ import tradeItem from './tradeItem.js';
import clientConfig from './clientConfig.js';
import characteristics from './characteristics.js';
/**
* Contains all the models that are related to the application.
*
* @example
* models.tradeItem.findAll();
*
* @example
* models.tradeItem.findAll().then((data) => {
* console.log(data);
* });
*
* @example
* models.tradeItem.create({
* tradeItemName: 'Test',
* foo: 'bar',
* });
*
*
* @type {Object.<string, Sequelize.Model>}
*/
let models = {
additionalPricePerPiece: additionalPricePerPiece(sequelize),
botanicalNames: botanicalNames(sequelize),
@ -40,6 +60,14 @@ if (process.env.SECRETS) {
});
}
/**
* Creates the connection to the database.
*
* @example
* let sequelize = createConnection();
*
* @returns {Sequelize} Sequelize instance with the connection to the database.
*/
function createConnection() {
console.log('Creating the connection...');
return new Sequelize(process.env.DB_SCHEMA, process.env.DB_USER, process.env.DB_PWD, {

View File

@ -4,6 +4,7 @@ import dotenv from 'dotenv';
import { models } from './models/index.js';
import { v4 as uuidv4 } from 'uuid';
dotenv.config();
/**
* The Endpoint where the Access Token is requested
*/
@ -121,7 +122,7 @@ async function sleep(ms) {
/**
*
* returns every tradeitem from the organization
* Inserts every tradeitem from the organization into the DB
*
* @param {*} organizationGln
*/