Built motion from commit fe909640.|2.6.8
[motion2.git] / server / api / chatQueueReport / chatQueueReport.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 _0x54d5=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','body','options','raw','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x212f2e,_0x88a046){var _0x591060=function(_0x261d04){while(--_0x261d04){_0x212f2e['push'](_0x212f2e['shift']());}};_0x591060(++_0x88a046);}(_0x54d5,0x1c9));var _0x554d=function(_0x25a26e,_0x176984){_0x25a26e=_0x25a26e-0x0;var _0x40146c=_0x54d5[_0x25a26e];return _0x40146c;};'use strict';var _=require(_0x554d('0x0'));var util=require(_0x554d('0x1'));var moment=require(_0x554d('0x2'));var BPromise=require(_0x554d('0x3'));var rs=require(_0x554d('0x4'));var fs=require('fs');var Redis=require(_0x554d('0x5'));var db=require(_0x554d('0x6'))['db'];var utils=require(_0x554d('0x7'));var logger=require(_0x554d('0x8'))(_0x554d('0x9'));var config=require(_0x554d('0xa'));var jayson=require(_0x554d('0xb'));var client=jayson[_0x554d('0xc')][_0x554d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xbfb36a,_0x10e5d7,_0x2bf169){return new BPromise(function(_0x6287b7,_0x86b107){return client[_0x554d('0xe')](_0xbfb36a,_0x2bf169)[_0x554d('0xf')](function(_0x297ca0){logger[_0x554d('0x10')](_0x554d('0x11'),_0x10e5d7,_0x554d('0x12'));logger['debug'](_0x554d('0x13'),_0x10e5d7,_0x554d('0x12'),JSON[_0x554d('0x14')](_0x297ca0));if(_0x297ca0['error']){if(_0x297ca0[_0x554d('0x15')][_0x554d('0x16')]===0x1f4){logger['error'](_0x554d('0x11'),_0x10e5d7,_0x297ca0[_0x554d('0x15')]['message']);return _0x86b107(_0x297ca0[_0x554d('0x15')][_0x554d('0x17')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x10e5d7,_0x297ca0[_0x554d('0x15')][_0x554d('0x17')]);return _0x6287b7(_0x297ca0[_0x554d('0x15')][_0x554d('0x17')]);}else{logger['info'](_0x554d('0x11'),_0x10e5d7,_0x554d('0x12'));_0x6287b7(_0x297ca0[_0x554d('0x18')][_0x554d('0x17')]);}})[_0x554d('0x19')](function(_0x2ebdfc){logger[_0x554d('0x15')](_0x554d('0x11'),_0x10e5d7,_0x2ebdfc);_0x86b107(_0x2ebdfc);});});}exports[_0x554d('0x1a')]=function(_0x5a7871){var _0x3e40f3=this;return new Promise(function(_0x342006,_0x553926){return db['ChatQueueReport']['create'](_0x5a7871[_0x554d('0x1b')],{'raw':_0x5a7871[_0x554d('0x1c')]?_0x5a7871['options'][_0x554d('0x1d')]===undefined?!![]:![]:!![]})[_0x554d('0xf')](function(_0x571417){logger[_0x554d('0x10')](_0x554d('0x1a'),_0x5a7871);logger['debug'](_0x554d('0x1a'),_0x5a7871,JSON[_0x554d('0x14')](_0x571417));_0x342006(_0x571417);})[_0x554d('0x19')](function(_0x43bd4e){logger[_0x554d('0x15')](_0x554d('0x1a'),_0x43bd4e[_0x554d('0x17')],_0x5a7871);_0x553926(_0x3e40f3[_0x554d('0x15')](0x1f4,_0x43bd4e[_0x554d('0x17')]));});});};exports[_0x554d('0x1e')]=function(_0x14bfdb){var _0x11a63a=this;return new Promise(function(_0x416ade,_0x2973f1){return db['ChatQueueReport']['update'](_0x14bfdb[_0x554d('0x1b')],{'raw':_0x14bfdb[_0x554d('0x1c')]?_0x14bfdb[_0x554d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14bfdb[_0x554d('0x1c')]?_0x14bfdb[_0x554d('0x1c')][_0x554d('0x1f')]||null:null,'attributes':_0x14bfdb['options']?_0x14bfdb[_0x554d('0x1c')][_0x554d('0x20')]||null:null,'limit':_0x14bfdb[_0x554d('0x1c')]?_0x14bfdb[_0x554d('0x1c')][_0x554d('0x21')]||null:null})[_0x554d('0xf')](function(_0x432ec8){logger[_0x554d('0x10')](_0x554d('0x1e'),_0x14bfdb);logger['debug'](_0x554d('0x1e'),_0x14bfdb,JSON['stringify'](_0x432ec8));_0x416ade(_0x432ec8);})[_0x554d('0x19')](function(_0x3a2700){logger[_0x554d('0x15')](_0x554d('0x1e'),_0x3a2700[_0x554d('0x17')],_0x14bfdb);_0x2973f1(_0x11a63a[_0x554d('0x15')](0x1f4,_0x3a2700[_0x554d('0x17')]));});});};