front/modules/commonModule.js

/* ============================================================================ *\
|| ########################################################################## ||
|| # Auction Software Marketplace          Release: 0.6   Build 0.7         # ||
|| # ---------------------------------------------------------------------- # ||
|| # License # 35YAHCNR9344X6O666C123AB                                     # ||
|| # ---------------------------------------------------------------------- # ||
|| # Copyright ©2014–2021 Develop Scripts LLC. All Rights Reserved          # ||
|| # This file may not be redistributed in whole or significant part.       # ||
|| # ------------- AUCTION SOFTWARE IS NOT FREE SOFTWARE ------------------ # ||
|| # http://www.auctionsoftwaremarketplace.com|support@auctionsoftware.com  # ||
|| # ---------------------------------------------------------------------- # ||
|| ########################################################################## ||
\* ============================================================================ */

const dateFormat = require('dateformat')
const md5 = require('md5')
const _ = require('underscore')

const mysqclass = require('./mysqli').default
/**
 * @class class to handle common functions
 */
class commonModule {
    static async getConfigVariable() {
        const mysql = {}
        const escapeData = []
        const strQuery = await mysqclass.mysqli(mysql, 'sitesettings')
        const dataReturn = await global.mysql.query(strQuery, escapeData)
        return dataReturn
    }

    static async getallBidIncrements() {
        const mysql = {}
        const escapeData = []
        const strQuery = await mysqclass.mysqli(mysql, 'get_all_bid_increment')
        const dataReturn = await global.mysql.query(strQuery, escapeData)
        return dataReturn
    }

    static async getBidIncrementdefault() {
        const mysql = {}
        const escapeData = []
        const strQuery = await mysqclass.mysqli(mysql, 'get_bid_inc_default')
        const dataReturn = await global.mysql.query(strQuery, escapeData)
        return dataReturn
    }

    static async commonTableEntries(item) {
        const mysql = {}
        const escapeData = []
        mysql.tableUsed = item.ext_name
        const strQuery = await mysqclass.mysqli(mysql, 'get_all_tableentries')
        const dataReturn = await global.mysql.query(strQuery, escapeData)
        return dataReturn
    }

    /**
     * Get Static Content
     * @param {number} id id of the static page which has to be fetched
     * @returns {object} sql response
     */
    static async getStaticContent(id) {
        const mysql = {}
        const escapeData = [id, id]
        const strQuery = await mysqclass.mysqli(mysql, 'get_static_page')
        const dataReturn = await global.mysql.query(strQuery, escapeData)
        return dataReturn
    }
}

module.exports.default = commonModule