Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / chatGroup / chatGroup.controller.js
index dca31ff..01453e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x180f=['filter','options','ChatGroup','includeAll','include','findAll','show','params','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','map','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','name','send','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','field'];(function(_0x162ee0,_0x291661){var _0x48fc5e=function(_0x297a35){while(--_0x297a35){_0x162ee0['push'](_0x162ee0['shift']());}};_0x48fc5e(++_0x291661);}(_0x180f,0xf3));var _0xf180=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x180f[_0x2fff83];return _0xa2a722;};'use strict';var pdf=require(_0xf180('0x0'));var emlformat=require(_0xf180('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf180('0x2'));var jsonpatch=require(_0xf180('0x3'));var rp=require('request-promise');var moment=require(_0xf180('0x4'));var BPromise=require(_0xf180('0x5'));var Mustache=require(_0xf180('0x6'));var util=require(_0xf180('0x7'));var path=require(_0xf180('0x8'));var sox=require('sox');var csv=require(_0xf180('0x9'));var ejs=require(_0xf180('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf180('0xb'));var jsforce=require(_0xf180('0xc'));var deskjs=require(_0xf180('0xd'));var toCsv=require(_0xf180('0x9'));var querystring=require(_0xf180('0xe'));var Papa=require(_0xf180('0xf'));var Redis=require(_0xf180('0x10'));var authService=require(_0xf180('0x11'));var qs=require(_0xf180('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf180('0x13'))(_0xf180('0x14'));var utils=require(_0xf180('0x15'));var config=require(_0xf180('0x16'));var db=require(_0xf180('0x17'))['db'];config[_0xf180('0x18')]=_[_0xf180('0x19')](config[_0xf180('0x18')],{'host':_0xf180('0x1a'),'port':0x18eb});var socket=require(_0xf180('0x1b'))(new Redis(config[_0xf180('0x18')]));require('./chatGroup.socket')[_0xf180('0x1c')](socket);var jayson=require(_0xf180('0x1d'));var client=jayson[_0xf180('0x1e')][_0xf180('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x48b00e,_0x43add2,_0x3d3f48){if(_0x3d3f48){var _0x1dbdcf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1dbdcf['test'](_0x43add2)){return _0x48b00e;}else{throw new Error(_0xf180('0x20'));}}else{return _0x48b00e;}}function respondWithRpcPromise(_0x726be6,_0x496e65,_0x115b86,_0x44a0d8){return new BPromise(function(_0x492c22,_0x4aa215){var _0x14ddc6=_0x44a0d8||client;return _0x14ddc6[_0xf180('0x21')](_0x726be6,_0x115b86)[_0xf180('0x22')](function(_0x3eb0db){logger[_0xf180('0x23')](_0xf180('0x24'),_0x496e65,_0xf180('0x25'));logger[_0xf180('0x26')](_0xf180('0x27'),_0x496e65,_0xf180('0x25'),JSON[_0xf180('0x28')](_0x3eb0db));if(_0x3eb0db[_0xf180('0x29')]){if(_0x3eb0db['error'][_0xf180('0x2a')]===0x1f4){logger[_0xf180('0x29')]('ChatGroup,\x20%s,\x20%s',_0x496e65,_0x3eb0db[_0xf180('0x29')]['message']);return _0x4aa215(_0x3eb0db[_0xf180('0x29')]['message']);}logger[_0xf180('0x29')](_0xf180('0x24'),_0x496e65,_0x3eb0db['error']['message']);return _0x492c22(_0x3eb0db[_0xf180('0x29')][_0xf180('0x2b')]);}else{logger['info'](_0xf180('0x24'),_0x496e65,_0xf180('0x25'));_0x492c22(_0x3eb0db[_0xf180('0x2c')][_0xf180('0x2b')]);}})[_0xf180('0x2d')](function(_0x2ca8f9){logger[_0xf180('0x29')](_0xf180('0x24'),_0x496e65,_0x2ca8f9);_0x4aa215(_0x2ca8f9);});});}function respondWithStatusCode(_0x3d20bc,_0x34d380){_0x34d380=_0x34d380||0xcc;return function(_0x4ff4f9){if(_0x4ff4f9){return _0x3d20bc[_0xf180('0x2e')](_0x34d380);}return _0x3d20bc[_0xf180('0x2f')](_0x34d380)[_0xf180('0x30')]();};}function respondWithResult(_0x113478,_0x37379c){_0x37379c=_0x37379c||0xc8;return function(_0x2aeee4){if(_0x2aeee4){return _0x113478[_0xf180('0x2f')](_0x37379c)[_0xf180('0x31')](_0x2aeee4);}};}function respondWithFilteredResult(_0x2ac6d2,_0x3bb197){return function(_0x564ce1){if(_0x564ce1){var _0x323482=_0x564ce1[_0xf180('0x32')],_0xe9a66b=_0x3bb197[_0xf180('0x33')],_0x3dc187=_0x3bb197[_0xf180('0x33')]+_0x3bb197[_0xf180('0x34')],_0x2cf029;if(_0x3dc187>=_0x323482){_0x3dc187=_0x323482;_0x2cf029=0xc8;}else{_0x2cf029=0xce;}_0x2ac6d2[_0xf180('0x2f')](_0x2cf029);return _0x2ac6d2[_0xf180('0x35')](_0xf180('0x36'),_0xe9a66b+'-'+_0x3dc187+'/'+_0x323482)[_0xf180('0x31')](_0x564ce1);}return null;};}function patchUpdates(_0x247068){return function(_0x92f335){try{jsonpatch['apply'](_0x92f335,_0x247068,!![]);}catch(_0x117e59){return BPromise[_0xf180('0x37')](_0x117e59);}return _0x92f335['save']();};}function saveUpdates(_0x2e286a,_0x57e3cf){return function(_0x444f9f){if(_0x444f9f){return _0x444f9f[_0xf180('0x38')](_0x2e286a)[_0xf180('0x22')](function(_0x5226c6){return _0x5226c6;});}return null;};}function removeEntity(_0x85ede7,_0x2c5d05){return function(_0x139f27){if(_0x139f27){return _0x139f27[_0xf180('0x39')]()['then'](function(){_0x85ede7[_0xf180('0x2f')](0xcc)[_0xf180('0x30')]();});}};}function handleEntityNotFound(_0x438d2c,_0x2e8830){return function(_0x9ed275){if(!_0x9ed275){_0x438d2c[_0xf180('0x2e')](0x194);}return _0x9ed275;};}function handleError(_0x3ec832,_0x1eb817){_0x1eb817=_0x1eb817||0x1f4;return function(_0x3ebcc9){logger[_0xf180('0x29')](_0x3ebcc9['stack']);if(_0x3ebcc9[_0xf180('0x3a')]){delete _0x3ebcc9['name'];}_0x3ec832['status'](_0x1eb817)[_0xf180('0x3b')](_0x3ebcc9);};}exports['index']=function(_0x5aead7,_0x3f8313){var _0x5ae674={},_0x9d65e0={},_0x46b53c={'count':0x0,'rows':[]};var _0x588c19=db['ChatGroup'][_0xf180('0x3c')];_0x9d65e0['model']=_[_0xf180('0x3d')](_0x588c19);_0x9d65e0['query']=_[_0xf180('0x3d')](_0x5aead7[_0xf180('0x3e')]);_0x9d65e0[_0xf180('0x3f')]=_[_0xf180('0x40')](_0x9d65e0[_0xf180('0x41')],_0x9d65e0[_0xf180('0x3e')]);_0x5ae674[_0xf180('0x42')]=_[_0xf180('0x40')](_0x9d65e0[_0xf180('0x41')],qs['fields'](_0x5aead7[_0xf180('0x3e')][_0xf180('0x43')]));_0x5ae674['attributes']=_0x5ae674[_0xf180('0x42')][_0xf180('0x44')]?_0x5ae674[_0xf180('0x42')]:_0x9d65e0[_0xf180('0x41')];if(!_0x5aead7['query'][_0xf180('0x45')]('nolimit')){_0x5ae674[_0xf180('0x34')]=qs[_0xf180('0x34')](_0x5aead7[_0xf180('0x3e')][_0xf180('0x34')]);_0x5ae674['offset']=qs['offset'](_0x5aead7[_0xf180('0x3e')][_0xf180('0x33')]);}_0x5ae674[_0xf180('0x46')]=qs[_0xf180('0x47')](_0x5aead7[_0xf180('0x3e')][_0xf180('0x47')]);_0x5ae674[_0xf180('0x48')]=qs[_0xf180('0x3f')](_[_0xf180('0x49')](_0x5aead7[_0xf180('0x3e')],_0x9d65e0['filters']));if(_0x5aead7[_0xf180('0x3e')]['filter']){_0x5ae674[_0xf180('0x48')]=_[_0xf180('0x4a')](_0x5ae674[_0xf180('0x48')],{'$or':_['map'](_0x588c19,function(_0x433098){if(_0x433098[_0xf180('0x4b')]['key']!==_0xf180('0x4c')){var _0x1a4eaa={};_0x1a4eaa[_0x433098[_0xf180('0x4d')]]={'$like':'%'+_0x5aead7[_0xf180('0x3e')][_0xf180('0x4e')]+'%'};return _0x1a4eaa;}})});}_0x5ae674=_[_0xf180('0x4a')]({},_0x5ae674,_0x5aead7[_0xf180('0x4f')]);var _0x466e08={'where':_0x5ae674[_0xf180('0x48')]};return db[_0xf180('0x50')][_0xf180('0x32')](_0x466e08)[_0xf180('0x22')](function(_0x39737c){_0x46b53c[_0xf180('0x32')]=_0x39737c;if(_0x5aead7[_0xf180('0x3e')][_0xf180('0x51')]){_0x5ae674[_0xf180('0x52')]=[{'all':!![]}];}return db[_0xf180('0x50')][_0xf180('0x53')](_0x5ae674);})[_0xf180('0x22')](function(_0x49e7ab){_0x46b53c['rows']=_0x49e7ab;return _0x46b53c;})[_0xf180('0x22')](respondWithFilteredResult(_0x3f8313,_0x5ae674))[_0xf180('0x2d')](handleError(_0x3f8313,null));};exports[_0xf180('0x54')]=function(_0x1d7cc2,_0x1915b4){var _0x30e469={'raw':!![],'where':{'id':_0x1d7cc2[_0xf180('0x55')]['id']}},_0x1acc63={};_0x1acc63[_0xf180('0x41')]=_[_0xf180('0x3d')](db[_0xf180('0x50')][_0xf180('0x3c')]);_0x1acc63[_0xf180('0x3e')]=_[_0xf180('0x3d')](_0x1d7cc2[_0xf180('0x3e')]);_0x1acc63['filters']=_[_0xf180('0x40')](_0x1acc63[_0xf180('0x41')],_0x1acc63['query']);_0x30e469[_0xf180('0x42')]=_[_0xf180('0x40')](_0x1acc63[_0xf180('0x41')],qs[_0xf180('0x43')](_0x1d7cc2[_0xf180('0x3e')][_0xf180('0x43')]));_0x30e469[_0xf180('0x42')]=_0x30e469[_0xf180('0x42')][_0xf180('0x44')]?_0x30e469[_0xf180('0x42')]:_0x1acc63[_0xf180('0x41')];if(_0x1d7cc2[_0xf180('0x3e')]['includeAll']){_0x30e469[_0xf180('0x52')]=[{'all':!![]}];}_0x30e469=_['merge']({},_0x30e469,_0x1d7cc2[_0xf180('0x4f')]);return db['ChatGroup']['find'](_0x30e469)['then'](handleEntityNotFound(_0x1915b4,null))['then'](respondWithResult(_0x1915b4,null))[_0xf180('0x2d')](handleError(_0x1915b4,null));};exports[_0xf180('0x56')]=function(_0x579d14,_0x242c69){return db[_0xf180('0x50')]['create'](_0x579d14[_0xf180('0x57')],{})['then'](respondWithResult(_0x242c69,0xc9))['catch'](handleError(_0x242c69,null));};exports['update']=function(_0x40ebbc,_0x279689){if(_0x40ebbc[_0xf180('0x57')]['id']){delete _0x40ebbc['body']['id'];}return db[_0xf180('0x50')][_0xf180('0x58')]({'where':{'id':_0x40ebbc[_0xf180('0x55')]['id']}})[_0xf180('0x22')](handleEntityNotFound(_0x279689,null))[_0xf180('0x22')](saveUpdates(_0x40ebbc['body'],null))[_0xf180('0x22')](respondWithResult(_0x279689,null))[_0xf180('0x2d')](handleError(_0x279689,null));};exports['destroy']=function(_0x2f4899,_0x1ce016){return db[_0xf180('0x50')][_0xf180('0x58')]({'where':{'id':_0x2f4899[_0xf180('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ce016,null))[_0xf180('0x22')](removeEntity(_0x1ce016,null))[_0xf180('0x2d')](handleError(_0x1ce016,null));};exports[_0xf180('0x59')]=function(_0xa9e711,_0x4ada84){return db[_0xf180('0x50')][_0xf180('0x59')]()[_0xf180('0x22')](respondWithResult(_0x4ada84,null))[_0xf180('0x2d')](handleError(_0x4ada84,null));};exports[_0xf180('0x5a')]=function(_0x5e50f4,_0x3272a3,_0x5dbc6c){return db[_0xf180('0x5b')][_0xf180('0x32')]({'where':{'ChatGroupId':_0x5e50f4['params']['id'],'ToId':_0x5e50f4['user']['id'],'read':![]}})['then'](function(_0x101450){return{'id':_[_0xf180('0x5c')](_0x5e50f4[_0xf180('0x55')]['id']),'count':_0x101450};})[_0xf180('0x22')](respondWithResult(_0x3272a3,null))[_0xf180('0x2d')](handleError(_0x3272a3,null));};exports['addMembers']=function(_0x5aee7d,_0x343e3f,_0x4e8f46){return db[_0xf180('0x50')][_0xf180('0x58')]({'where':{'id':_0x5aee7d[_0xf180('0x55')]['id']}})[_0xf180('0x22')](handleEntityNotFound(_0x343e3f,null))[_0xf180('0x22')](function(_0x252bdb){if(_0x252bdb){return _0x252bdb[_0xf180('0x5d')](_0x5aee7d['body'][_0xf180('0x5e')],_[_0xf180('0x5f')](_0x5aee7d[_0xf180('0x57')],['ids','id'])||{});}})[_0xf180('0x22')](respondWithResult(_0x343e3f,null))[_0xf180('0x2d')](handleError(_0x343e3f,null));};exports[_0xf180('0x60')]=function(_0x5874aa,_0x31fc7e,_0x4269e2){var _0x41fde4={};var _0x321136={};var _0x19bce3;var _0x523d14;return db[_0xf180('0x50')][_0xf180('0x61')]({'where':{'id':_0x5874aa[_0xf180('0x55')]['id']}})['then'](handleEntityNotFound(_0x31fc7e,null))[_0xf180('0x22')](function(_0x66ac3a){if(_0x66ac3a){_0x19bce3=_0x66ac3a;_0x321136['model']=_[_0xf180('0x3d')](db[_0xf180('0x62')][_0xf180('0x3c')]);_0x321136[_0xf180('0x3e')]=_['keys'](_0x5874aa[_0xf180('0x3e')]);_0x321136[_0xf180('0x3f')]=_[_0xf180('0x40')](_0x321136[_0xf180('0x41')],_0x321136[_0xf180('0x3e')]);_0x41fde4[_0xf180('0x42')]=_['intersection'](_0x321136['model'],qs[_0xf180('0x43')](_0x5874aa[_0xf180('0x3e')][_0xf180('0x43')]));_0x41fde4[_0xf180('0x42')]=_0x41fde4[_0xf180('0x42')][_0xf180('0x44')]?_0x41fde4['attributes']:_0x321136[_0xf180('0x41')];_0x41fde4[_0xf180('0x46')]=qs['sort'](_0x5874aa['query'][_0xf180('0x47')]);_0x41fde4['where']=qs['filters'](_['pick'](_0x5874aa[_0xf180('0x3e')],_0x321136['filters']));if(_0x5874aa['query'][_0xf180('0x4e')]){_0x41fde4[_0xf180('0x48')]=_['merge'](_0x41fde4[_0xf180('0x48')],{'$or':_[_0xf180('0x63')](_0x41fde4[_0xf180('0x42')],function(_0x56ac4b){var _0x30f4b1={};_0x30f4b1[_0x56ac4b]={'$like':'%'+_0x5874aa[_0xf180('0x3e')]['filter']+'%'};return _0x30f4b1;})});}_0x41fde4=_[_0xf180('0x4a')]({},_0x41fde4,_0x5874aa['options']);return _0x19bce3[_0xf180('0x60')](_0x41fde4);}})[_0xf180('0x22')](function(_0x593a2c){if(_0x593a2c){_0x523d14=_0x593a2c['length'];if(!_0x5874aa[_0xf180('0x3e')][_0xf180('0x45')](_0xf180('0x64'))){_0x41fde4[_0xf180('0x34')]=qs[_0xf180('0x34')](_0x5874aa['query']['limit']);_0x41fde4[_0xf180('0x33')]=qs[_0xf180('0x33')](_0x5874aa[_0xf180('0x3e')]['offset']);}return _0x19bce3['getMembers'](_0x41fde4);}})[_0xf180('0x22')](function(_0x502fd1){if(_0x502fd1){return _0x502fd1?{'count':_0x523d14,'rows':_0x502fd1}:null;}})[_0xf180('0x22')](respondWithResult(_0x31fc7e,null))[_0xf180('0x2d')](handleError(_0x31fc7e,null));};exports[_0xf180('0x65')]=function(_0x2ec979,_0x56ac3c,_0x426d50){return db[_0xf180('0x50')][_0xf180('0x58')]({'where':{'id':_0x2ec979[_0xf180('0x55')]['id']}})[_0xf180('0x22')](handleEntityNotFound(_0x56ac3c,null))[_0xf180('0x22')](function(_0x5369c2){if(_0x5369c2){return _0x5369c2[_0xf180('0x65')](_0x2ec979[_0xf180('0x3e')][_0xf180('0x5e')]);}})[_0xf180('0x22')](respondWithStatusCode(_0x56ac3c,null))[_0xf180('0x2d')](handleError(_0x56ac3c,null));};exports[_0xf180('0x66')]=function(_0x1837ef,_0x289494,_0x341584){if(_0x1837ef[_0xf180('0x57')]['id']){delete _0x1837ef['body']['id'];}return db[_0xf180('0x50')][_0xf180('0x58')]({'where':{'id':_0x1837ef[_0xf180('0x55')]['id']}})[_0xf180('0x22')](handleEntityNotFound(_0x289494,null))['then'](function(_0x4ee9fd){if(_0x4ee9fd){_0x1837ef[_0xf180('0x57')][_0xf180('0x67')]=_0x4ee9fd['id'];return db[_0xf180('0x5b')]['create'](_0x1837ef[_0xf180('0x57')]);}})[_0xf180('0x22')](respondWithResult(_0x289494,null))[_0xf180('0x2d')](handleError(_0x289494,null));};exports[_0xf180('0x68')]=function(_0x465408,_0x30b8cb,_0x21dd10){var _0x1accf0={};var _0x151070={};var _0x436aed;var _0x21103e;return db[_0xf180('0x50')][_0xf180('0x61')]({'where':{'id':_0x465408[_0xf180('0x55')]['id']}})[_0xf180('0x22')](handleEntityNotFound(_0x30b8cb,null))['then'](function(_0x23f2ed){if(_0x23f2ed){_0x436aed=_0x23f2ed;_0x151070[_0xf180('0x41')]=_[_0xf180('0x3d')](db['ChatInternalMessage'][_0xf180('0x3c')]);_0x151070['query']=_[_0xf180('0x3d')](_0x465408['query']);_0x151070[_0xf180('0x3f')]=_['intersection'](_0x151070[_0xf180('0x41')],_0x151070[_0xf180('0x3e')]);_0x1accf0[_0xf180('0x42')]=_[_0xf180('0x40')](_0x151070[_0xf180('0x41')],qs[_0xf180('0x43')](_0x465408[_0xf180('0x3e')][_0xf180('0x43')]));_0x1accf0[_0xf180('0x42')]=_0x1accf0[_0xf180('0x42')][_0xf180('0x44')]?_0x1accf0[_0xf180('0x42')]:_0x151070[_0xf180('0x41')];_0x1accf0[_0xf180('0x46')]=qs[_0xf180('0x47')](_0x465408['query'][_0xf180('0x47')]);_0x1accf0['where']=qs[_0xf180('0x3f')](_[_0xf180('0x49')](_0x465408[_0xf180('0x3e')],_0x151070[_0xf180('0x3f')]));if(_0x465408[_0xf180('0x3e')][_0xf180('0x4e')]){_0x1accf0[_0xf180('0x48')]=_[_0xf180('0x4a')](_0x1accf0[_0xf180('0x48')],{'$or':_[_0xf180('0x63')](_0x1accf0['attributes'],function(_0x290415){var _0x3fdf82={};_0x3fdf82[_0x290415]={'$like':'%'+_0x465408[_0xf180('0x3e')][_0xf180('0x4e')]+'%'};return _0x3fdf82;})});}if(_0x465408[_0xf180('0x3e')]['$gte']){var _0x1b3a01=_0x465408['query']['$gte'][_0xf180('0x69')](',');var _0x292c26={};_0x292c26[_0x1b3a01[0x0]]={'$gte':moment(_0x1b3a01[0x1])['format'](_0xf180('0x6a'))};_0x1accf0['where']=_[_0xf180('0x4a')](_0x1accf0[_0xf180('0x48')],_0x292c26);}_0x1accf0=_['merge']({},_0x1accf0,_0x465408[_0xf180('0x4f')]);return _0x436aed[_0xf180('0x68')](_0x1accf0);}})['then'](function(_0x637251){if(_0x637251){_0x21103e=_0x637251[_0xf180('0x44')];if(!_0x465408[_0xf180('0x3e')][_0xf180('0x45')](_0xf180('0x64'))){_0x1accf0['limit']=qs['limit'](_0x465408[_0xf180('0x3e')][_0xf180('0x34')]);_0x1accf0['offset']=qs[_0xf180('0x33')](_0x465408['query'][_0xf180('0x33')]);}return _0x436aed[_0xf180('0x68')](_0x1accf0);}})[_0xf180('0x22')](function(_0x37be9c){if(_0x37be9c){return _0x37be9c?{'count':_0x21103e,'rows':_0x37be9c}:null;}})[_0xf180('0x22')](respondWithResult(_0x30b8cb,null))[_0xf180('0x2d')](handleError(_0x30b8cb,null));};
\ No newline at end of file
+var _0x984b=['rows','show','params','length','options','find','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','User','pick','map','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','create','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','field','ChatGroup','count','includeAll','include','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x984b,0xee));var _0xb984=function(_0x138dd8,_0x37fd7e){_0x138dd8=_0x138dd8-0x0;var _0x4347ca=_0x984b[_0x138dd8];return _0x4347ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb984('0x0'));var jsonpatch=require(_0xb984('0x1'));var rp=require(_0xb984('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb984('0x3'));var util=require(_0xb984('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb984('0x5'));var ejs=require(_0xb984('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var hardwareService=require(_0xb984('0xf'));var logger=require(_0xb984('0x10'))(_0xb984('0x11'));var utils=require(_0xb984('0x12'));var config=require(_0xb984('0x13'));var db=require(_0xb984('0x14'))['db'];config[_0xb984('0x15')]=_['defaults'](config[_0xb984('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xb984('0x16'))(new Redis(config[_0xb984('0x15')]));require('./chatGroup.socket')[_0xb984('0x17')](socket);var jayson=require(_0xb984('0x18'));var client=jayson['client'][_0xb984('0x19')]({'port':0x232a});function checkPasswordPattern(_0x7a1b60,_0x549791,_0xede12d){if(_0xede12d){var _0x4073cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4073cb['test'](_0x549791)){return _0x7a1b60;}else{throw new Error(_0xb984('0x1a'));}}else{return _0x7a1b60;}}function respondWithRpcPromise(_0x5cd1aa,_0x3b8241,_0x1dc4df,_0x3238a6){return new BPromise(function(_0x3f7cff,_0x59dcb7){var _0x396c36=_0x3238a6||client;return _0x396c36[_0xb984('0x1b')](_0x5cd1aa,_0x1dc4df)[_0xb984('0x1c')](function(_0x9afbee){logger[_0xb984('0x1d')](_0xb984('0x1e'),_0x3b8241,'request\x20sent');logger[_0xb984('0x1f')](_0xb984('0x20'),_0x3b8241,_0xb984('0x21'),JSON[_0xb984('0x22')](_0x9afbee));if(_0x9afbee[_0xb984('0x23')]){if(_0x9afbee[_0xb984('0x23')]['code']===0x1f4){logger[_0xb984('0x23')](_0xb984('0x1e'),_0x3b8241,_0x9afbee['error'][_0xb984('0x24')]);return _0x59dcb7(_0x9afbee[_0xb984('0x23')][_0xb984('0x24')]);}logger[_0xb984('0x23')](_0xb984('0x1e'),_0x3b8241,_0x9afbee[_0xb984('0x23')][_0xb984('0x24')]);return _0x3f7cff(_0x9afbee['error'][_0xb984('0x24')]);}else{logger[_0xb984('0x1d')](_0xb984('0x1e'),_0x3b8241,'request\x20sent');_0x3f7cff(_0x9afbee[_0xb984('0x25')][_0xb984('0x24')]);}})[_0xb984('0x26')](function(_0x2d0450){logger[_0xb984('0x23')](_0xb984('0x1e'),_0x3b8241,_0x2d0450);_0x59dcb7(_0x2d0450);});});}function respondWithStatusCode(_0x1faa95,_0x4b3da0){_0x4b3da0=_0x4b3da0||0xcc;return function(_0x5d93d9){if(_0x5d93d9){return _0x1faa95[_0xb984('0x27')](_0x4b3da0);}return _0x1faa95[_0xb984('0x28')](_0x4b3da0)[_0xb984('0x29')]();};}function respondWithResult(_0x2bd0f2,_0x4fb896){_0x4fb896=_0x4fb896||0xc8;return function(_0xa44895){if(_0xa44895){return _0x2bd0f2[_0xb984('0x28')](_0x4fb896)[_0xb984('0x2a')](_0xa44895);}};}function respondWithFilteredResult(_0x482a9f,_0x363e33){return function(_0x311e22){if(_0x311e22){var _0x2012ca=_0x311e22['count'],_0x3d2757=_0x363e33[_0xb984('0x2b')],_0x4d00a8=_0x363e33[_0xb984('0x2b')]+_0x363e33['limit'],_0x5b8da1;if(_0x4d00a8>=_0x2012ca){_0x4d00a8=_0x2012ca;_0x5b8da1=0xc8;}else{_0x5b8da1=0xce;}_0x482a9f[_0xb984('0x28')](_0x5b8da1);return _0x482a9f[_0xb984('0x2c')](_0xb984('0x2d'),_0x3d2757+'-'+_0x4d00a8+'/'+_0x2012ca)[_0xb984('0x2a')](_0x311e22);}return null;};}function patchUpdates(_0x518bef){return function(_0x4bb6da){try{jsonpatch[_0xb984('0x2e')](_0x4bb6da,_0x518bef,!![]);}catch(_0x2daa31){return BPromise[_0xb984('0x2f')](_0x2daa31);}return _0x4bb6da[_0xb984('0x30')]();};}function saveUpdates(_0x4df9e0,_0x44ef84){return function(_0x35b37f){if(_0x35b37f){return _0x35b37f[_0xb984('0x31')](_0x4df9e0)[_0xb984('0x1c')](function(_0x3d2714){return _0x3d2714;});}return null;};}function removeEntity(_0xaf5cca,_0x5f4426){return function(_0x54a293){if(_0x54a293){return _0x54a293[_0xb984('0x32')]()[_0xb984('0x1c')](function(){_0xaf5cca[_0xb984('0x28')](0xcc)[_0xb984('0x29')]();});}};}function handleEntityNotFound(_0x30891c,_0x55dc81){return function(_0x31f490){if(!_0x31f490){_0x30891c[_0xb984('0x27')](0x194);}return _0x31f490;};}function handleError(_0x4edaf1,_0x578a80){_0x578a80=_0x578a80||0x1f4;return function(_0x13a950){logger['error'](_0x13a950[_0xb984('0x33')]);if(_0x13a950[_0xb984('0x34')]){delete _0x13a950['name'];}_0x4edaf1[_0xb984('0x28')](_0x578a80)['send'](_0x13a950);};}exports[_0xb984('0x35')]=function(_0x5c25a9,_0x19bd91){var _0x557302={},_0x52f872={},_0xf6d925={'count':0x0,'rows':[]};var _0x4b0438=db['ChatGroup'][_0xb984('0x36')];_0x52f872[_0xb984('0x37')]=_['keys'](_0x4b0438);_0x52f872[_0xb984('0x38')]=_[_0xb984('0x39')](_0x5c25a9[_0xb984('0x38')]);_0x52f872[_0xb984('0x3a')]=_['intersection'](_0x52f872[_0xb984('0x37')],_0x52f872[_0xb984('0x38')]);_0x557302[_0xb984('0x3b')]=_[_0xb984('0x3c')](_0x52f872[_0xb984('0x37')],qs[_0xb984('0x3d')](_0x5c25a9[_0xb984('0x38')][_0xb984('0x3d')]));_0x557302[_0xb984('0x3b')]=_0x557302[_0xb984('0x3b')]['length']?_0x557302[_0xb984('0x3b')]:_0x52f872[_0xb984('0x37')];if(!_0x5c25a9[_0xb984('0x38')][_0xb984('0x3e')](_0xb984('0x3f'))){_0x557302[_0xb984('0x40')]=qs[_0xb984('0x40')](_0x5c25a9[_0xb984('0x38')]['limit']);_0x557302['offset']=qs[_0xb984('0x2b')](_0x5c25a9['query'][_0xb984('0x2b')]);}_0x557302[_0xb984('0x41')]=qs[_0xb984('0x42')](_0x5c25a9[_0xb984('0x38')]['sort']);_0x557302[_0xb984('0x43')]=qs[_0xb984('0x3a')](_['pick'](_0x5c25a9[_0xb984('0x38')],_0x52f872[_0xb984('0x3a')]));if(_0x5c25a9[_0xb984('0x38')][_0xb984('0x44')]){_0x557302[_0xb984('0x43')]=_[_0xb984('0x45')](_0x557302[_0xb984('0x43')],{'$or':_['map'](_0x4b0438,function(_0xbca7cd){if(_0xbca7cd[_0xb984('0x46')]['key']!=='VIRTUAL'){var _0x1ddb47={};_0x1ddb47[_0xbca7cd[_0xb984('0x47')]]={'$like':'%'+_0x5c25a9[_0xb984('0x38')][_0xb984('0x44')]+'%'};return _0x1ddb47;}})});}_0x557302=_[_0xb984('0x45')]({},_0x557302,_0x5c25a9['options']);var _0x664cb1={'where':_0x557302[_0xb984('0x43')]};return db[_0xb984('0x48')][_0xb984('0x49')](_0x664cb1)[_0xb984('0x1c')](function(_0x44865b){_0xf6d925[_0xb984('0x49')]=_0x44865b;if(_0x5c25a9[_0xb984('0x38')][_0xb984('0x4a')]){_0x557302[_0xb984('0x4b')]=[{'all':!![]}];}return db['ChatGroup'][_0xb984('0x4c')](_0x557302);})[_0xb984('0x1c')](function(_0x4bd4db){_0xf6d925[_0xb984('0x4d')]=_0x4bd4db;return _0xf6d925;})[_0xb984('0x1c')](respondWithFilteredResult(_0x19bd91,_0x557302))[_0xb984('0x26')](handleError(_0x19bd91,null));};exports[_0xb984('0x4e')]=function(_0x2052f0,_0x49dde7){var _0x10f813={'raw':!![],'where':{'id':_0x2052f0[_0xb984('0x4f')]['id']}},_0x2b69aa={};_0x2b69aa[_0xb984('0x37')]=_['keys'](db[_0xb984('0x48')][_0xb984('0x36')]);_0x2b69aa[_0xb984('0x38')]=_[_0xb984('0x39')](_0x2052f0[_0xb984('0x38')]);_0x2b69aa[_0xb984('0x3a')]=_[_0xb984('0x3c')](_0x2b69aa[_0xb984('0x37')],_0x2b69aa[_0xb984('0x38')]);_0x10f813['attributes']=_[_0xb984('0x3c')](_0x2b69aa[_0xb984('0x37')],qs[_0xb984('0x3d')](_0x2052f0['query'][_0xb984('0x3d')]));_0x10f813[_0xb984('0x3b')]=_0x10f813['attributes'][_0xb984('0x50')]?_0x10f813['attributes']:_0x2b69aa[_0xb984('0x37')];if(_0x2052f0[_0xb984('0x38')]['includeAll']){_0x10f813[_0xb984('0x4b')]=[{'all':!![]}];}_0x10f813=_[_0xb984('0x45')]({},_0x10f813,_0x2052f0[_0xb984('0x51')]);return db[_0xb984('0x48')][_0xb984('0x52')](_0x10f813)[_0xb984('0x1c')](handleEntityNotFound(_0x49dde7,null))['then'](respondWithResult(_0x49dde7,null))[_0xb984('0x26')](handleError(_0x49dde7,null));};exports['create']=function(_0x4553d1,_0x40b54d){return db[_0xb984('0x48')]['create'](_0x4553d1['body'],{})[_0xb984('0x1c')](respondWithResult(_0x40b54d,0xc9))[_0xb984('0x26')](handleError(_0x40b54d,null));};exports['update']=function(_0x493a8b,_0x1e8847){if(_0x493a8b[_0xb984('0x53')]['id']){delete _0x493a8b[_0xb984('0x53')]['id'];}return db[_0xb984('0x48')][_0xb984('0x52')]({'where':{'id':_0x493a8b[_0xb984('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1e8847,null))['then'](saveUpdates(_0x493a8b[_0xb984('0x53')],null))[_0xb984('0x1c')](respondWithResult(_0x1e8847,null))['catch'](handleError(_0x1e8847,null));};exports[_0xb984('0x32')]=function(_0x159835,_0x294d39){return db[_0xb984('0x48')]['find']({'where':{'id':_0x159835['params']['id']}})[_0xb984('0x1c')](handleEntityNotFound(_0x294d39,null))[_0xb984('0x1c')](removeEntity(_0x294d39,null))[_0xb984('0x26')](handleError(_0x294d39,null));};exports[_0xb984('0x54')]=function(_0x3bdadc,_0x3cc2a0){return db['ChatGroup'][_0xb984('0x54')]()[_0xb984('0x1c')](respondWithResult(_0x3cc2a0,null))[_0xb984('0x26')](handleError(_0x3cc2a0,null));};exports[_0xb984('0x55')]=function(_0x2d77dd,_0xdb7a50,_0x575503){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x2d77dd[_0xb984('0x4f')]['id'],'ToId':_0x2d77dd[_0xb984('0x56')]['id'],'read':![]}})[_0xb984('0x1c')](function(_0x475d49){return{'id':_[_0xb984('0x57')](_0x2d77dd['params']['id']),'count':_0x475d49};})[_0xb984('0x1c')](respondWithResult(_0xdb7a50,null))[_0xb984('0x26')](handleError(_0xdb7a50,null));};exports[_0xb984('0x58')]=function(_0x5549f3,_0x935abe,_0x10e37b){return db['ChatGroup']['find']({'where':{'id':_0x5549f3[_0xb984('0x4f')]['id']}})['then'](handleEntityNotFound(_0x935abe,null))['then'](function(_0x174384){if(_0x174384){return _0x174384['addMembers'](_0x5549f3[_0xb984('0x53')][_0xb984('0x59')],_[_0xb984('0x5a')](_0x5549f3[_0xb984('0x53')],[_0xb984('0x59'),'id'])||{});}})[_0xb984('0x1c')](respondWithResult(_0x935abe,null))[_0xb984('0x26')](handleError(_0x935abe,null));};exports[_0xb984('0x5b')]=function(_0x4269e0,_0x2b187f,_0x742a0f){var _0x1d9213={};var _0x479b52={};var _0x284df9;var _0x5f126e;return db[_0xb984('0x48')]['findOne']({'where':{'id':_0x4269e0['params']['id']}})[_0xb984('0x1c')](handleEntityNotFound(_0x2b187f,null))[_0xb984('0x1c')](function(_0x74fc95){if(_0x74fc95){_0x284df9=_0x74fc95;_0x479b52['model']=_[_0xb984('0x39')](db[_0xb984('0x5c')][_0xb984('0x36')]);_0x479b52[_0xb984('0x38')]=_[_0xb984('0x39')](_0x4269e0[_0xb984('0x38')]);_0x479b52[_0xb984('0x3a')]=_[_0xb984('0x3c')](_0x479b52[_0xb984('0x37')],_0x479b52[_0xb984('0x38')]);_0x1d9213[_0xb984('0x3b')]=_[_0xb984('0x3c')](_0x479b52[_0xb984('0x37')],qs[_0xb984('0x3d')](_0x4269e0['query'][_0xb984('0x3d')]));_0x1d9213['attributes']=_0x1d9213[_0xb984('0x3b')]['length']?_0x1d9213[_0xb984('0x3b')]:_0x479b52[_0xb984('0x37')];_0x1d9213[_0xb984('0x41')]=qs[_0xb984('0x42')](_0x4269e0[_0xb984('0x38')][_0xb984('0x42')]);_0x1d9213[_0xb984('0x43')]=qs[_0xb984('0x3a')](_[_0xb984('0x5d')](_0x4269e0[_0xb984('0x38')],_0x479b52[_0xb984('0x3a')]));if(_0x4269e0[_0xb984('0x38')][_0xb984('0x44')]){_0x1d9213['where']=_['merge'](_0x1d9213[_0xb984('0x43')],{'$or':_[_0xb984('0x5e')](_0x1d9213[_0xb984('0x3b')],function(_0x48f52d){var _0x45ee77={};_0x45ee77[_0x48f52d]={'$like':'%'+_0x4269e0[_0xb984('0x38')]['filter']+'%'};return _0x45ee77;})});}_0x1d9213=_['merge']({},_0x1d9213,_0x4269e0['options']);return _0x284df9[_0xb984('0x5b')](_0x1d9213);}})['then'](function(_0x4e4456){if(_0x4e4456){_0x5f126e=_0x4e4456['length'];if(!_0x4269e0[_0xb984('0x38')][_0xb984('0x3e')](_0xb984('0x3f'))){_0x1d9213[_0xb984('0x40')]=qs['limit'](_0x4269e0['query'][_0xb984('0x40')]);_0x1d9213[_0xb984('0x2b')]=qs[_0xb984('0x2b')](_0x4269e0[_0xb984('0x38')][_0xb984('0x2b')]);}return _0x284df9['getMembers'](_0x1d9213);}})[_0xb984('0x1c')](function(_0x3e7ed1){if(_0x3e7ed1){return _0x3e7ed1?{'count':_0x5f126e,'rows':_0x3e7ed1}:null;}})[_0xb984('0x1c')](respondWithResult(_0x2b187f,null))[_0xb984('0x26')](handleError(_0x2b187f,null));};exports[_0xb984('0x5f')]=function(_0x19f73b,_0x4f51a0,_0x1bb691){return db['ChatGroup'][_0xb984('0x52')]({'where':{'id':_0x19f73b[_0xb984('0x4f')]['id']}})[_0xb984('0x1c')](handleEntityNotFound(_0x4f51a0,null))[_0xb984('0x1c')](function(_0x1d18e8){if(_0x1d18e8){return _0x1d18e8['removeMembers'](_0x19f73b[_0xb984('0x38')][_0xb984('0x59')]);}})[_0xb984('0x1c')](respondWithStatusCode(_0x4f51a0,null))['catch'](handleError(_0x4f51a0,null));};exports[_0xb984('0x60')]=function(_0x2b5bd1,_0x19fb4f,_0x50a704){if(_0x2b5bd1[_0xb984('0x53')]['id']){delete _0x2b5bd1['body']['id'];}return db['ChatGroup'][_0xb984('0x52')]({'where':{'id':_0x2b5bd1[_0xb984('0x4f')]['id']}})[_0xb984('0x1c')](handleEntityNotFound(_0x19fb4f,null))[_0xb984('0x1c')](function(_0x50b3ab){if(_0x50b3ab){_0x2b5bd1[_0xb984('0x53')][_0xb984('0x61')]=_0x50b3ab['id'];return db[_0xb984('0x62')][_0xb984('0x63')](_0x2b5bd1['body']);}})[_0xb984('0x1c')](respondWithResult(_0x19fb4f,null))[_0xb984('0x26')](handleError(_0x19fb4f,null));};exports[_0xb984('0x64')]=function(_0x1a619f,_0x484a35,_0x14cd2c){var _0x22c612={};var _0x1d62e6={};var _0x2d686e;var _0x46e5c7;return db[_0xb984('0x48')][_0xb984('0x65')]({'where':{'id':_0x1a619f[_0xb984('0x4f')]['id']}})[_0xb984('0x1c')](handleEntityNotFound(_0x484a35,null))[_0xb984('0x1c')](function(_0x3dd2b4){if(_0x3dd2b4){_0x2d686e=_0x3dd2b4;_0x1d62e6['model']=_[_0xb984('0x39')](db[_0xb984('0x62')][_0xb984('0x36')]);_0x1d62e6[_0xb984('0x38')]=_[_0xb984('0x39')](_0x1a619f[_0xb984('0x38')]);_0x1d62e6['filters']=_[_0xb984('0x3c')](_0x1d62e6[_0xb984('0x37')],_0x1d62e6[_0xb984('0x38')]);_0x22c612[_0xb984('0x3b')]=_['intersection'](_0x1d62e6[_0xb984('0x37')],qs[_0xb984('0x3d')](_0x1a619f['query'][_0xb984('0x3d')]));_0x22c612['attributes']=_0x22c612['attributes'][_0xb984('0x50')]?_0x22c612[_0xb984('0x3b')]:_0x1d62e6[_0xb984('0x37')];_0x22c612[_0xb984('0x41')]=qs[_0xb984('0x42')](_0x1a619f[_0xb984('0x38')][_0xb984('0x42')]);_0x22c612[_0xb984('0x43')]=qs[_0xb984('0x3a')](_['pick'](_0x1a619f['query'],_0x1d62e6[_0xb984('0x3a')]));if(_0x1a619f[_0xb984('0x38')][_0xb984('0x44')]){_0x22c612[_0xb984('0x43')]=_['merge'](_0x22c612[_0xb984('0x43')],{'$or':_[_0xb984('0x5e')](_0x22c612[_0xb984('0x3b')],function(_0xc9a1a9){var _0x199c2={};_0x199c2[_0xc9a1a9]={'$like':'%'+_0x1a619f[_0xb984('0x38')]['filter']+'%'};return _0x199c2;})});}if(_0x1a619f[_0xb984('0x38')]['$gte']){var _0x38b0e6=_0x1a619f['query'][_0xb984('0x66')]['split'](',');var _0x55d92d={};_0x55d92d[_0x38b0e6[0x0]]={'$gte':moment(_0x38b0e6[0x1])[_0xb984('0x67')](_0xb984('0x68'))};_0x22c612['where']=_[_0xb984('0x45')](_0x22c612[_0xb984('0x43')],_0x55d92d);}_0x22c612=_[_0xb984('0x45')]({},_0x22c612,_0x1a619f[_0xb984('0x51')]);return _0x2d686e[_0xb984('0x64')](_0x22c612);}})['then'](function(_0x4daba4){if(_0x4daba4){_0x46e5c7=_0x4daba4[_0xb984('0x50')];if(!_0x1a619f[_0xb984('0x38')]['hasOwnProperty'](_0xb984('0x3f'))){_0x22c612[_0xb984('0x40')]=qs[_0xb984('0x40')](_0x1a619f['query'][_0xb984('0x40')]);_0x22c612['offset']=qs[_0xb984('0x2b')](_0x1a619f[_0xb984('0x38')]['offset']);}return _0x2d686e[_0xb984('0x64')](_0x22c612);}})[_0xb984('0x1c')](function(_0x328025){if(_0x328025){return _0x328025?{'count':_0x46e5c7,'rows':_0x328025}:null;}})[_0xb984('0x1c')](respondWithResult(_0x484a35,null))['catch'](handleError(_0x484a35,null));};
\ No newline at end of file