Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / faxQueueReport / faxQueueReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x6705=['../../config/environment','jayson/promise','then','info','request\x20sent','debug','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','update','raw','where','attributes','UpdateFaxQueueReport','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x1599aa,_0x2b48b6){var _0x2f2cb3=function(_0x43d0d2){while(--_0x43d0d2){_0x1599aa['push'](_0x1599aa['shift']());}};_0x2f2cb3(++_0x2b48b6);}(_0x6705,0x14b));var _0x5670=function(_0x56054c,_0x1e20f8){_0x56054c=_0x56054c-0x0;var _0x1d1b4a=_0x6705[_0x56054c];return _0x1d1b4a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5670('0x0'));var BPromise=require(_0x5670('0x1'));var rs=require(_0x5670('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5670('0x3'));var logger=require(_0x5670('0x4'))('rpc');var config=require(_0x5670('0x5'));var jayson=require(_0x5670('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2155,_0x4105cf,_0x783fb6){return new BPromise(function(_0x2cbbfd,_0x13e1b8){return client['request'](_0x1f2155,_0x783fb6)[_0x5670('0x7')](function(_0x5441fa){logger[_0x5670('0x8')]('FaxQueueReport,\x20%s,\x20%s',_0x4105cf,_0x5670('0x9'));logger[_0x5670('0xa')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4105cf,_0x5670('0x9'),JSON[_0x5670('0xb')](_0x5441fa));if(_0x5441fa[_0x5670('0xc')]){if(_0x5441fa[_0x5670('0xc')][_0x5670('0xd')]===0x1f4){logger[_0x5670('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x4105cf,_0x5441fa[_0x5670('0xc')][_0x5670('0xe')]);return _0x13e1b8(_0x5441fa[_0x5670('0xc')]['message']);}logger[_0x5670('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x4105cf,_0x5441fa[_0x5670('0xc')][_0x5670('0xe')]);return _0x2cbbfd(_0x5441fa[_0x5670('0xc')][_0x5670('0xe')]);}else{logger[_0x5670('0x8')](_0x5670('0xf'),_0x4105cf,_0x5670('0x9'));_0x2cbbfd(_0x5441fa[_0x5670('0x10')]['message']);}})[_0x5670('0x11')](function(_0x4382de){logger[_0x5670('0xc')](_0x5670('0xf'),_0x4105cf,_0x4382de);_0x13e1b8(_0x4382de);});});}exports[_0x5670('0x12')]=function(_0x44946f){var _0x4c0552=this;return new Promise(function(_0x144a09,_0xd89808){return db[_0x5670('0x13')][_0x5670('0x14')](_0x44946f[_0x5670('0x15')],{'raw':_0x44946f[_0x5670('0x16')]?_0x44946f[_0x5670('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5670('0x7')](function(_0x4c3ab9){logger[_0x5670('0x8')]('CreateFaxQueueReport',_0x44946f);logger[_0x5670('0xa')](_0x5670('0x12'),_0x44946f,JSON['stringify'](_0x4c3ab9));_0x144a09(_0x4c3ab9);})[_0x5670('0x11')](function(_0x1cb7cf){logger[_0x5670('0xc')](_0x5670('0x12'),_0x1cb7cf[_0x5670('0xe')],_0x44946f);_0xd89808(_0x4c0552[_0x5670('0xc')](0x1f4,_0x1cb7cf['message']));});});};exports['UpdateFaxQueueReport']=function(_0x596d40){var _0x36229f=this;return new Promise(function(_0x5868aa,_0x1bf71e){return db[_0x5670('0x13')][_0x5670('0x17')](_0x596d40[_0x5670('0x15')],{'raw':_0x596d40[_0x5670('0x16')]?_0x596d40[_0x5670('0x16')][_0x5670('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x596d40[_0x5670('0x16')]?_0x596d40[_0x5670('0x16')][_0x5670('0x19')]||null:null,'attributes':_0x596d40['options']?_0x596d40['options'][_0x5670('0x1a')]||null:null,'limit':_0x596d40[_0x5670('0x16')]?_0x596d40[_0x5670('0x16')]['limit']||null:null})[_0x5670('0x7')](function(_0x39a146){logger['info'](_0x5670('0x1b'),_0x596d40);logger[_0x5670('0xa')](_0x5670('0x1b'),_0x596d40,JSON[_0x5670('0xb')](_0x39a146));_0x5868aa(_0x39a146);})[_0x5670('0x11')](function(_0x541c6f){logger['error'](_0x5670('0x1b'),_0x541c6f['message'],_0x596d40);_0x1bf71e(_0x36229f[_0x5670('0xc')](0x1f4,_0x541c6f['message']));});});};