Built motion from commit 9d7072cc.|2.5.39
[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 _0x2ace=['result','CreateOpenchannelQueueReport','body','options','raw','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent'];(function(_0x446242,_0x31a20a){var _0xb1ccf4=function(_0x3b7604){while(--_0x3b7604){_0x446242['push'](_0x446242['shift']());}};_0xb1ccf4(++_0x31a20a);}(_0x2ace,0x17e));var _0xe2ac=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x2ace[_0xe45118];return _0x15e15d;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var moment=require(_0xe2ac('0x1'));var BPromise=require(_0xe2ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2ac('0x3'));var db=require(_0xe2ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2ac('0x5'))(_0xe2ac('0x6'));var config=require(_0xe2ac('0x7'));var jayson=require(_0xe2ac('0x8'));var client=jayson[_0xe2ac('0x9')][_0xe2ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1f8c,_0x391f96,_0x8e831b){return new BPromise(function(_0x28d0d1,_0x4064f9){return client[_0xe2ac('0xb')](_0x2f1f8c,_0x8e831b)[_0xe2ac('0xc')](function(_0x4fb111){logger['info'](_0xe2ac('0xd'),_0x391f96,'request\x20sent');logger[_0xe2ac('0xe')](_0xe2ac('0xf'),_0x391f96,'request\x20sent',JSON[_0xe2ac('0x10')](_0x4fb111));if(_0x4fb111[_0xe2ac('0x11')]){if(_0x4fb111[_0xe2ac('0x11')]['code']===0x1f4){logger[_0xe2ac('0x11')](_0xe2ac('0xd'),_0x391f96,_0x4fb111[_0xe2ac('0x11')][_0xe2ac('0x12')]);return _0x4064f9(_0x4fb111[_0xe2ac('0x11')]['message']);}logger[_0xe2ac('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x391f96,_0x4fb111[_0xe2ac('0x11')][_0xe2ac('0x12')]);return _0x28d0d1(_0x4fb111[_0xe2ac('0x11')][_0xe2ac('0x12')]);}else{logger[_0xe2ac('0x13')](_0xe2ac('0xd'),_0x391f96,_0xe2ac('0x14'));_0x28d0d1(_0x4fb111[_0xe2ac('0x15')][_0xe2ac('0x12')]);}})['catch'](function(_0x557ef6){logger[_0xe2ac('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x391f96,_0x557ef6);_0x4064f9(_0x557ef6);});});}exports[_0xe2ac('0x16')]=function(_0x3c8999){var _0x2aad2a=this;return new Promise(function(_0x2f5d32,_0x5000ba){return db['OpenchannelQueueReport']['create'](_0x3c8999[_0xe2ac('0x17')],{'raw':_0x3c8999[_0xe2ac('0x18')]?_0x3c8999[_0xe2ac('0x18')][_0xe2ac('0x19')]===undefined?!![]:![]:!![]})[_0xe2ac('0xc')](function(_0x279a90){logger['info']('CreateOpenchannelQueueReport',_0x3c8999);logger[_0xe2ac('0xe')]('CreateOpenchannelQueueReport',_0x3c8999,JSON[_0xe2ac('0x10')](_0x279a90));_0x2f5d32(_0x279a90);})[_0xe2ac('0x1a')](function(_0x2083b3){logger[_0xe2ac('0x11')](_0xe2ac('0x16'),_0x2083b3[_0xe2ac('0x12')],_0x3c8999);_0x5000ba(_0x2aad2a[_0xe2ac('0x11')](0x1f4,_0x2083b3[_0xe2ac('0x12')]));});});};exports[_0xe2ac('0x1b')]=function(_0x4e7597){var _0x5e27eb=this;return new Promise(function(_0x2f6220,_0x4c9981){return db[_0xe2ac('0x1c')][_0xe2ac('0x1d')](_0x4e7597['body'],{'raw':_0x4e7597[_0xe2ac('0x18')]?_0x4e7597['options'][_0xe2ac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7597[_0xe2ac('0x18')]?_0x4e7597[_0xe2ac('0x18')]['where']||null:null,'attributes':_0x4e7597[_0xe2ac('0x18')]?_0x4e7597[_0xe2ac('0x18')]['attributes']||null:null,'limit':_0x4e7597['options']?_0x4e7597[_0xe2ac('0x18')][_0xe2ac('0x1e')]||null:null})[_0xe2ac('0xc')](function(_0x23bef4){logger['info'](_0xe2ac('0x1b'),_0x4e7597);logger['debug'](_0xe2ac('0x1b'),_0x4e7597,JSON[_0xe2ac('0x10')](_0x23bef4));_0x2f6220(_0x23bef4);})[_0xe2ac('0x1a')](function(_0xbc6eed){logger[_0xe2ac('0x11')](_0xe2ac('0x1b'),_0xbc6eed['message'],_0x4e7597);_0x4c9981(_0x5e27eb[_0xe2ac('0x11')](0x1f4,_0xbc6eed['message']));});});};