How to use the mssql.Promise function in mssql

To help you get started, we’ve selected a few mssql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ShoppinPal / StockUp / workers / workers-v2 / generate-stock-order / generate-stock-order-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const TODAYS_DATE = new Date();
const rp = require('request-promise');
const REPORT_STATES = utils.REPORT_STATES;
/**
 * One option is a combination of products with VPN > Color > Shade
 * Need to find out Reorder points at option level
 * So, let's create options levels with keys as "VPN-Color-Shade"
 * For example:
 *  '30782-Pink-Dark'
 */
var runMe = function (payload, config, taskId, messageId) {

    var orgModelId = payload.orgModelId;
github ShoppinPal / StockUp / workers / workers-v2 / fetch-incremental-inventory / fetch-incremental-inventoryDims-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const INVENTORY_DIM_TABLE = 'HSInventDimStaging';
const INVENTORY_PER_PAGE = 1000;
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const maxBatchSize = 1000;

var runMe = function (sqlPool, orgModelId, inventorySyncModel) {
    try {
        // Global variable for logging

        logger.debug({
            commandName: commandName,
            argv: process.argv,
            orgModelId,
            inventorySyncModel
github ShoppinPal / StockUp / workers / workers-v2 / fetch-incremental-sales / fetch-incremental-sales-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const SALES_TABLE = 'RetailTransactionStaging';
const SALES_PER_PAGE = 1000;
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const transactionConstants = require('../constants/sales-constants.json');

var runMe = function (sqlPool, orgModelId, salesSyncModel) {
    try {
        // Global variable for logging

        logger.debug({
            commandName: commandName,
            argv: process.argv,
            orgModelId,
            salesSyncModel
github ShoppinPal / StockUp / workers / workers-v2 / fetch-incremental-products / fetch-incremental-products-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const PRODUCT_TABLE = 'HSPRODUCTSYNCTABLEStaging';
const PRODUCTS_PER_PAGE = 1000;
// Global variable for logging
var commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension

var runMe = function (sqlPool, orgModelId, productSyncModel) {
    try {
        var incrementalProducts, productsToDelete;

        logger.debug({
            commandName: commandName,
            argv: process.argv,
            orgModelId,
            productSyncModel
github ShoppinPal / StockUp / workers / workers-v2 / generate-reorder-points / generate-reorder-points-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const LEAD_TIME_IN_DAYS = 1;
const REVIEW_TIME_IN_DAYS = 1;
const CSL_MULTIPLIER = 1.03; //NORMSINV(0.85) 85% success rate
const TODAYS_DATE = new Date();
var runMe = function (payload, config, taskId, messageId) {

    var orgModelId = payload.orgModelId;
    var storeModelId = payload.storeModelId;
    try {
        // Global variable for logging

        logger.debug({
            commandName: commandName,
github ShoppinPal / StockUp / workers / workers-v2 / fetch-incremental-inventory / fetch-incremental-inventory-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const INVENTORY_SUM_TABLE = 'HSInventSumStaging';
const INVENTORY_DIM_TABLE = 'HSInventDimStaging';
const INVENTORY_PER_PAGE = 1000;
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const maxBatchSize = 1000;

var runMe = function (sqlPool, orgModelId, inventorySyncModel) {
    try {
        // Global variable for logging

        logger.debug({
            commandName: commandName,
            argv: process.argv,
            orgModelId,
github ShoppinPal / StockUp / workers / workers-v2 / fetch-incremental-products / fetch-incremental-products-category-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const PRODUCT_TABLE = 'EcoResProductV2Staging';
const PRODUCTS_PER_PAGE = 1000;
var commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension

var runMe = function (sqlPool, orgModelId, productCategorySyncModel) {
    try {
        var incrementalProducts, productsToDelete;
        // Global variable for logging

        logger.debug({
            commandName: commandName,
            argv: process.argv,
            orgModelId,
            productCategorySyncModel
github ShoppinPal / StockUp / workers / workers-v2 / generate-transfer-order-msd / generate-transfer-order-msd.js View on Github external
const REPORT_EMPTY = 'Executing...';
const REPORT_COMPLETE = 'Complete';
const REPORT_ERROR = 'Error';
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const MSDUtil = require('./../../jobs/utils/msd.js');
const Promise = require('bluebird');
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const TODAYS_DATE = new Date();
const rp = require('request-promise');
var runMe = function (payload, config, taskId, messageId) {

    var orgModelId = payload.orgModelId;
    var reportModelId = payload.reportModelId;
    var createdTransferOrder, stockOrderLineItemModels;
    var reportModelInstance;
    try {
        // Global variable for logging

        logger.debug({
github ShoppinPal / StockUp / workers / workers-v2 / fetch-incremental-sales / fetch-incremental-sales-lines-msd.js View on Github external
const logger = require('sp-json-logger')();
const sql = require('mssql');
const dbUrl = process.env.DB_URL;
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectID;
var db = null; //database connected
const utils = require('./../../jobs/utils/utils.js');
const path = require('path');
sql.Promise = require('bluebird');
const _ = require('underscore');
const Promise = require('bluebird');
const SALES_LINES_TABLE = 'RetailTransactionSalesLineStaging';
const SALES_LINES_PER_PAGE = 1000;
const commandName = path.basename(__filename, '.js'); // gives the filename without the .js extension
const transactionConstants = require('../constants/sales-constants.json');

var runMe = function (sqlPool, orgModelId, salesLineSyncModel) {
    try {
        // Global variable for logging
        logger.debug({
            commandName: commandName,
            argv: process.argv,
            orgModelId,
            salesLineSyncModel
        });