bd612f4ae7fab344dd08364195c072eb89517d09
[motion2.git] / server / api / openchannelQueueReport / openchannelQueueReport.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 _0xa866=['catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result'];(function(_0x4c438e,_0x54d4bd){var _0x504c69=function(_0x3bebfd){while(--_0x3bebfd){_0x4c438e['push'](_0x4c438e['shift']());}};_0x504c69(++_0x54d4bd);}(_0xa866,0x6a));var _0x6a86=function(_0x598d20,_0x488480){_0x598d20=_0x598d20-0x0;var _0x7ac1da=_0xa866[_0x598d20];return _0x7ac1da;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});}exports['CreateOpenchannelQueueReport']=function(_0x50024d){var _0x11fe3b=this;return new Promise(function(_0x535fd9,_0x588a2f){return db[_0x6a86('0x17')][_0x6a86('0x18')](_0x50024d[_0x6a86('0x19')],{'raw':_0x50024d['options']?_0x50024d[_0x6a86('0x1a')][_0x6a86('0x1b')]===undefined?!![]:![]:!![]})[_0x6a86('0xc')](function(_0x262bf5){logger[_0x6a86('0xd')](_0x6a86('0x1c'),_0x50024d);logger['debug']('CreateOpenchannelQueueReport',_0x50024d,JSON['stringify'](_0x262bf5));_0x535fd9(_0x262bf5);})[_0x6a86('0x16')](function(_0x2007c7){logger[_0x6a86('0x12')](_0x6a86('0x1c'),_0x2007c7['message'],_0x50024d);_0x588a2f(_0x11fe3b[_0x6a86('0x12')](0x1f4,_0x2007c7[_0x6a86('0x14')]));});});};exports[_0x6a86('0x1d')]=function(_0x3f2b70){var _0x19382d=this;return new Promise(function(_0x1c41a7,_0x46f6c7){return db[_0x6a86('0x17')][_0x6a86('0x1e')](_0x3f2b70['body'],{'raw':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')]['where']||null:null,'attributes':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')][_0x6a86('0x1f')]||null:null,'limit':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['limit']||null:null})['then'](function(_0x4d8bf0){logger[_0x6a86('0xd')](_0x6a86('0x1d'),_0x3f2b70);logger[_0x6a86('0xf')]('UpdateOpenchannelQueueReport',_0x3f2b70,JSON[_0x6a86('0x11')](_0x4d8bf0));_0x1c41a7(_0x4d8bf0);})[_0x6a86('0x16')](function(_0x1bb745){logger[_0x6a86('0x12')]('UpdateOpenchannelQueueReport',_0x1bb745[_0x6a86('0x14')],_0x3f2b70);_0x46f6c7(_0x19382d['error'](0x1f4,_0x1bb745[_0x6a86('0x14')]));});});};