This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const db = require('../models'); | |
const Logger = require('../helpers/logger.helper'); | |
const callLifeCycle = db.call_life_cycle; | |
const newcall_handler = async (dataObj, insert_params, where_params) => { | |
const t1 = await sequelize.transaction(); | |
try { | |
let query_newcall_result = await callLifeCycle.findOne({ | |
where: where_params, | |
transaction: t1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAllKeys = async (fields) => { | |
try { | |
let promiseArray = await Promise.all( | |
Object.keys(fields).map(async (entry) => { | |
const uri = `${baseUrl}${entry}Fields?${params}&${api_token}`; | |
const person_result = await axios.get(uri); | |
let data = await person_result.data.data.map((field) => { | |
const { id, key, name } = field; | |
return { id, key, name }; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DateArrMaker { | |
constructor(minMonth, maxMonth, year) { | |
if (isNaN(minMonth) || isNaN(maxMonth) || isNaN(year)) { | |
throw new Error(`all values must be numeric`); | |
} | |
// if (maxMonth < minMonth) { | |
// let temp = maxMonth; | |
// minMonth = maxMonth; | |
// maxMonth = temp; | |
// } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see: https://davidwalsh.name/javascript-proxy-with-storage | |
function getStorage() { | |
return new Proxy(window.localStorage, { | |
// just a helper to see if value is valid json ie stringified obj or array | |
set: (obj, prop, value) => { | |
value !== null && typeof value === 'object' | |
? obj.setItem(prop, JSON.stringify(value)) | |
: obj.setItem(prop, value); | |
console.log(`${prop} added to localstorage!😀`); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// -- https://dbdiagram.io/d/5e8f12c739d18f5553fd5b60 | |
//// -- LEVEL 1 | |
//// -- Tables and References | |
// Creating tables | |
Table users as U { | |
id int [pk, increment] // auto-increment | |
fName varchar | |
lName varchar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Logger = require('./logger.service'); | |
const { parse } = require('json2csv'); | |
// opt contain fieldsc | |
const jsonTocsv = (data, opt) => { | |
console.log('jsonTocsv -> opt', opt); | |
console.log('jsonTocsv -> data', data[0]); | |
try { | |
if (!data || !data.length) return null; | |
const csv = parse(data, opt); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CryptoJS = require('crypto-js'); | |
const SECRET_KEYB = process.env.SECRET_KEYB; | |
class CryptoHandler { | |
constructor() { | |
if (!SECRET_KEYB || !SECRET_KEYB.length) { | |
throw new ErrorHandler(500, 'please see env'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
name: 'color-picker', | |
template: /*html*/ ` | |
<div class="row" style="margin-bottom:0;"> | |
<div | |
class="input-field col s12" | |
@click="openColorPicker"> | |
<i class="material-icons prefix">color</i> | |
<input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sqlite3 = require('sqlite3').verbose(); | |
const { open } = require('sqlite'); | |
const path = require('path'); | |
const fs = require('fs').promises; | |
async function checkFileExists(file) { | |
try { | |
return await fs.stat(file); | |
} catch (error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function printAll($spaces = 0, $payload) | |
{ | |
$currentIndentation = str_repeat(" ", $spaces); | |
if (is_string($payload)) { | |
echo " $payload<br/>"; | |
} | |
if (is_array($payload)) { | |
foreach ($payload as $key => $value) { | |
echo "<br/> $currentIndentation $key: "; |
OlderNewer