/* ============================================================================ *\
|| ########################################################################## ||
|| # 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 commonProduct = require('../../common/products').default
const commonSQL = require('../../common/sql').default
const mysqclass = require('./mysqli').default
/**
* @class class to handle cart functions
*/
class appointmentModule {
/**
* Get all available appointments
* @param {object} req req object
* @returns {object} sql response
*/
static async getAllAvailableAppointments(req) {
let mysql = ''
let row = ''
let where = ''
const order = 'a.id asc'
where += ``
row = 'get_all_available_appointments'
let uidc = 0
const dateNow = dateFormat(new Date(), 'yyyy-mm-dd HH:MM:ss')
let betweenDate = new Date(new Date().getTime() + 3 * 24 * 60 * 60 * 1000)
betweenDate = dateFormat(betweenDate, 'yyyy-mm-dd HH:MM:ss')
if (req.user) {
uidc = typeof req.user.id === 'undefined' ? 0 : req.user.id
}
const escapeData = [dateNow, betweenDate, uidc]
const ordergor = order === '' ? '' : `order by ${order}`
mysql = {
where,
order: ordergor,
userid: uidc,
}
const strQuery = await mysqclass.mysqli(mysql, row)
const dataReturn = await global.mysql.query(strQuery, escapeData)
return dataReturn
}
}
module.exports.default = appointmentModule