Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / components / interaction / service.js
index c319a47..8a5ffae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x238f=['upperFirst','InteractionId','toLowerCase','role','null','Interaction','update','then','catch','tracked','user','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions'];(function(_0x51766c,_0x4110ef){var _0x243c62=function(_0xdefdbe){while(--_0xdefdbe){_0x51766c['push'](_0x51766c['shift']());}};_0x243c62(++_0x4110ef);}(_0x238f,0x1d4));var _0xf238=function(_0x3105b3,_0x5a1835){_0x3105b3=_0x3105b3-0x0;var _0x375d28=_0x238f[_0x3105b3];return _0x375d28;};'use strict';var _=require(_0xf238('0x0'));var db=require(_0xf238('0x1'))['db'];var loggers={'openchannel':require(_0xf238('0x2'))(_0xf238('0x3')),'mail':require(_0xf238('0x2'))(_0xf238('0x4')),'fax':require(_0xf238('0x2'))(_0xf238('0x5')),'sms':require(_0xf238('0x2'))(_0xf238('0x6')),'chat':require(_0xf238('0x2'))('chat-interactions'),'whatsapp':require(_0xf238('0x2'))('whatsapp-interactions')};function getInteractionId(_0x598a56,_0x5334d4,_0xbf4b15){if(_0x598a56&&_0x598a56[_[_0xf238('0x7')](_0xbf4b15)+_0xf238('0x8')]){return _0x598a56[_['upperFirst'](_0xbf4b15)+_0xf238('0x8')];}else if(_0x598a56&&_0x598a56['id']){return _0x598a56['id'];}else if(_0x5334d4&&_0x5334d4['id']){return _0x5334d4['id'];}else{return'unknown';}}function log(_0x448421,_0x52c322,_0x49aca3,_0x33907a,_0x26a174,_0x1cc918){loggers[_0x26a174[_0xf238('0x9')]()][_0x448421]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1cc918['toUpperCase'](),_0x52c322?_0x52c322['id']:null,_0x52c322?_0x52c322['name']:null,_0x52c322?_0x52c322[_0xf238('0xa')]:null,getInteractionId(_0x49aca3,_0x33907a,_0x26a174),_0x49aca3?JSON['stringify'](_0x49aca3):_0xf238('0xb'));}function updateUser(_0x2d4467,_0x4a1dbd,_0x2cd6ac,_0x5a286b,_0x5a0855){db[_[_0xf238('0x7')](_0x5a286b)+_0xf238('0xc')]['findOne']({'where':{'id':getInteractionId(_0x4a1dbd,_0x2cd6ac,_0x5a286b)}})['then'](function(_0x95b431){if(_0x95b431){return _0x95b431[_0xf238('0xd')]({'UserId':_0x2d4467?_0x2d4467['id']:null});}})[_0xf238('0xe')](function(_0x5345ac){if(_0x5345ac){log('info',_0x2d4467,_0x4a1dbd,_0x2cd6ac,_0x5a286b,_0x5a0855);}})[_0xf238('0xf')](function(){log('error',_0x2d4467,_0x4a1dbd,_0x2cd6ac,_0x5a286b,_0x5a0855);});}exports[_0xf238('0x10')]=function(_0x5af383,_0x21e0fc){return function(_0x25da5b,_0x3e3400,_0x2671cf){var _0x3086a3=_0x25da5b[_0xf238('0x11')];var _0xdfca05={};var _0x283a3a=_0x25da5b['query'];if(_0xdfca05){_0xdfca05=_[_0xf238('0x12')](_0x25da5b[_0xf238('0x13')]);_0xdfca05=_[_0xf238('0x14')](_0xdfca05,[_0xf238('0x13'),_0xf238('0x15'),_0xf238('0x16'),_0xf238('0x17'),_0xf238('0x18')]);}updateUser(_0x3086a3,_0xdfca05,_0x283a3a,_0x5af383,_0x21e0fc);_0x2671cf(null);};};
\ No newline at end of file
+var _0xfe7b=['clause','order','forEach','contactName','closed','DESC','getFilteredInteractions','rows','catch','query','omit','phone','fax','mobile','updateUser','lodash','./utils','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','body','where','contact','default','fields','filter','user','having','read','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe7b,0xf9));var _0xbfe7=function(_0x4e2148,_0x382a2c){_0x4e2148=_0x4e2148-0x0;var _0x323345=_0xfe7b[_0x4e2148];return _0x323345;};'use strict';var _=require(_0xbfe7('0x0'));var sqlUtils=require('./sql-utils');var utils=require(_0xbfe7('0x1'));exports['findAll']=function(_0x4e5f20,_0x180a66,_0x5ebc48,_0x4f08b9,_0x388350){var _0x5a7d85={'count':0x0,'rows':[]};var _0x2cc2b3=sqlUtils[_0xbfe7('0x2')](_0x4e5f20,_0x5ebc48,_0x180a66);if(_0x2cc2b3){return Promise[_0xbfe7('0x3')](_0x5a7d85);}var _0x311a1c=sqlUtils[_0xbfe7('0x4')](_0x4e5f20);var _0x15e72d={};return Promise[_0xbfe7('0x3')]()[_0xbfe7('0x5')](function(){if(_0x180a66[_0xbfe7('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x180a66['search'],_0x388350);}else{return sqlUtils[_0xbfe7('0x7')](_0x4e5f20,_0x180a66,_0x388350);}})[_0xbfe7('0x5')](function(_0x30b0ac){_0x311a1c['where'](_0x30b0ac[_0xbfe7('0x8')]);_0x311a1c[_0xbfe7('0x9')](_0x30b0ac[_0xbfe7('0xa')]);_0x311a1c[_0xbfe7('0x9')](_0x30b0ac[_0xbfe7('0xb')]);_0x311a1c['where'](_0x30b0ac[_0xbfe7('0xc')]);_0x311a1c[_0xbfe7('0x9')](_0x30b0ac[_0xbfe7('0xd')]);_0x311a1c[_0xbfe7('0x9')](_0x30b0ac[_0xbfe7('0xe')]);_0x311a1c[_0xbfe7('0xf')](_0x30b0ac[_0xbfe7('0x10')]);_0x15e72d=_0x30b0ac[_0xbfe7('0x11')];return sqlUtils[_0xbfe7('0x12')](_0x4e5f20,_0x5ebc48,_0x180a66);})[_0xbfe7('0x5')](function(_0x13515c){_0x311a1c[_0xbfe7('0x9')](_0x13515c);_0x311a1c[_0xbfe7('0x13')](_0xbfe7('0x14'));var _0x143043=_0x180a66[_0xbfe7('0x6')]?_0x15e72d['ids']:_0x180a66[_0xbfe7('0x15')];return sqlUtils[_0xbfe7('0x16')](_0x311a1c,_0x143043);})['then'](function(_0x5c45ed){_0x5a7d85[_0xbfe7('0x17')]=_0x5c45ed['length'];if(_0x5a7d85[_0xbfe7('0x17')]===0x0){return[];}_0x311a1c[_0xbfe7('0xf')](_0x15e72d[_0xbfe7('0x18')]);if(_0x4f08b9['order']){_0x4f08b9[_0xbfe7('0x19')][_0xbfe7('0x1a')](function(_0x33709a){var _0xe7f737=_0x33709a[0x0]===_0xbfe7('0x1b')?_0x33709a[0x0]:'i.'+_0x33709a[0x0];_0x311a1c[_0xbfe7('0x19')](_0xe7f737,_0x33709a[0x1]==='DESC'?![]:!![]);if(_0x33709a[0x0]===_0xbfe7('0x1c')){var _0x25e877=sqlUtils['getClosedOrderClause'](_0x4e5f20,_0x180a66);_0x311a1c['order'](_0x25e877,_0x33709a[0x1]===_0xbfe7('0x1d')?![]:!![]);}});}return sqlUtils[_0xbfe7('0x1e')](_0x4e5f20,_0x311a1c,_0x180a66,_0x4f08b9);})['then'](function(_0x22891d){_0x5a7d85[_0xbfe7('0x1f')]=_0x22891d;return _0x5a7d85;})[_0xbfe7('0x20')](function(_0x403c49){throw _0x403c49;});};exports['tracked']=function(_0x1046a0,_0x4c7586){return function(_0x5b0857,_0x2fae19,_0xf10dd2){var _0x191ee5=_0x5b0857[_0xbfe7('0xe')];var _0x1f3479={};var _0x19487e=_0x5b0857[_0xbfe7('0x21')];if(_0x1f3479){_0x1f3479=_['clone'](_0x5b0857['body']);_0x1f3479=_[_0xbfe7('0x22')](_0x1f3479,[_0xbfe7('0x8'),'html',_0xbfe7('0x23'),_0xbfe7('0x24'),_0xbfe7('0x25')]);}utils[_0xbfe7('0x26')](_0x191ee5,_0x1f3479,_0x19487e,_0x1046a0,_0x4c7586);_0xf10dd2(null);};};
\ No newline at end of file