Built motion from commit (unavailable).|2.5.20
[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 _0x239e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatQueueReport','create','options','ChatQueueReport','update','body','raw','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment'];(function(_0x3804da,_0x4b1678){var _0x1038e3=function(_0x46dbaf){while(--_0x46dbaf){_0x3804da['push'](_0x3804da['shift']());}};_0x1038e3(++_0x4b1678);}(_0x239e,0x10d));var _0xe239=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x239e[_0x32056c];return _0x317313;};'use strict';var _=require(_0xe239('0x0'));var util=require(_0xe239('0x1'));var moment=require(_0xe239('0x2'));var BPromise=require(_0xe239('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe239('0x4'));var db=require(_0xe239('0x5'))['db'];var utils=require(_0xe239('0x6'));var logger=require(_0xe239('0x7'))(_0xe239('0x8'));var config=require(_0xe239('0x9'));var jayson=require(_0xe239('0xa'));var client=jayson['client'][_0xe239('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7e5cc4,_0x25a2bd,_0x1c8e62){return new BPromise(function(_0x2c58cd,_0x1bba3e){return client[_0xe239('0xc')](_0x7e5cc4,_0x1c8e62)[_0xe239('0xd')](function(_0x1179ac){logger[_0xe239('0xe')](_0xe239('0xf'),_0x25a2bd,_0xe239('0x10'));logger[_0xe239('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x25a2bd,_0xe239('0x10'),JSON[_0xe239('0x12')](_0x1179ac));if(_0x1179ac[_0xe239('0x13')]){if(_0x1179ac[_0xe239('0x13')]['code']===0x1f4){logger['error'](_0xe239('0xf'),_0x25a2bd,_0x1179ac['error'][_0xe239('0x14')]);return _0x1bba3e(_0x1179ac['error'][_0xe239('0x14')]);}logger[_0xe239('0x13')](_0xe239('0xf'),_0x25a2bd,_0x1179ac[_0xe239('0x13')][_0xe239('0x14')]);return _0x2c58cd(_0x1179ac[_0xe239('0x13')][_0xe239('0x14')]);}else{logger[_0xe239('0xe')](_0xe239('0xf'),_0x25a2bd,_0xe239('0x10'));_0x2c58cd(_0x1179ac[_0xe239('0x15')][_0xe239('0x14')]);}})[_0xe239('0x16')](function(_0x47b22a){logger[_0xe239('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x25a2bd,_0x47b22a);_0x1bba3e(_0x47b22a);});});}exports[_0xe239('0x17')]=function(_0x18b021){var _0x2b28d5=this;return new Promise(function(_0x27ebe2,_0x488b7a){return db['ChatQueueReport'][_0xe239('0x18')](_0x18b021['body'],{'raw':_0x18b021['options']?_0x18b021[_0xe239('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe239('0xd')](function(_0x1faa51){logger[_0xe239('0xe')](_0xe239('0x17'),_0x18b021);logger['debug'](_0xe239('0x17'),_0x18b021,JSON['stringify'](_0x1faa51));_0x27ebe2(_0x1faa51);})[_0xe239('0x16')](function(_0x1e41db){logger['error']('CreateChatQueueReport',_0x1e41db[_0xe239('0x14')],_0x18b021);_0x488b7a(_0x2b28d5[_0xe239('0x13')](0x1f4,_0x1e41db[_0xe239('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x30718d){var _0x480f4b=this;return new Promise(function(_0x2a9202,_0x405a3c){return db[_0xe239('0x1a')][_0xe239('0x1b')](_0x30718d[_0xe239('0x1c')],{'raw':_0x30718d[_0xe239('0x19')]?_0x30718d[_0xe239('0x19')][_0xe239('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30718d[_0xe239('0x19')]?_0x30718d[_0xe239('0x19')][_0xe239('0x1e')]||null:null,'attributes':_0x30718d[_0xe239('0x19')]?_0x30718d[_0xe239('0x19')][_0xe239('0x1f')]||null:null,'limit':_0x30718d[_0xe239('0x19')]?_0x30718d[_0xe239('0x19')][_0xe239('0x20')]||null:null})[_0xe239('0xd')](function(_0x2bbfe1){logger['info'](_0xe239('0x21'),_0x30718d);logger[_0xe239('0x11')](_0xe239('0x21'),_0x30718d,JSON[_0xe239('0x12')](_0x2bbfe1));_0x2a9202(_0x2bbfe1);})[_0xe239('0x16')](function(_0x2358e0){logger[_0xe239('0x13')](_0xe239('0x21'),_0x2358e0['message'],_0x30718d);_0x405a3c(_0x480f4b[_0xe239('0x13')](0x1f4,_0x2358e0[_0xe239('0x14')]));});});};