Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / config / seedContact.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 _0x4f59=['now','push','Biondo','innocenzo.biondo','CmContact','then','bulkCreate','finished\x20populating','CmHopper','destroy','hopper1','log','contacts2','hopper2','util','../mysqldb','Innocenzo','@xcally.com'];(function(_0x21f716,_0x579404){var _0x47c992=function(_0x83c839){while(--_0x83c839){_0x21f716['push'](_0x21f716['shift']());}};_0x47c992(++_0x579404);}(_0x4f59,0x176));var _0x94f5=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x4f59[_0x5b64a1];return _0x4b6f55;};'use strict';var util=require(_0x94f5('0x0'));var db=require(_0x94f5('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x94f5('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x94f5('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x94f5('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x94f5('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x94f5('0x5')]({'id':i,'firstName':_0x94f5('0x2')+i,'lastName':_0x94f5('0x6')+i,'phone':0xf879fb460+i,'email':_0x94f5('0x7')+i+_0x94f5('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x94f5('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x94f5('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x94f5('0x4')](),'updatedAt':Date[_0x94f5('0x4')]()});}db[_0x94f5('0x8')]['destroy']({'where':{}})[_0x94f5('0x9')](function(){return db[_0x94f5('0x8')][_0x94f5('0xa')](contacts);})[_0x94f5('0x9')](function(){console['log'](_0x94f5('0xb'),'contacts1');return db[_0x94f5('0xc')][_0x94f5('0xd')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x94f5('0xa')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x94f5('0xe'));return db[_0x94f5('0x8')][_0x94f5('0xa')](contacts2);})[_0x94f5('0x9')](function(){console[_0x94f5('0xf')](_0x94f5('0xb'),_0x94f5('0x10'));return db[_0x94f5('0xc')]['bulkCreate'](hopper2);})['then'](function(){console[_0x94f5('0xf')](_0x94f5('0xb'),_0x94f5('0x11'));})['catch'](function(_0x846586){console[_0x94f5('0xf')](_0x846586);});