4fa3b763917fa0f6dcd41b69956971715b6b2f47
[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 _0x220e=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','then','CmContact','bulkCreate','log','contacts1','CmHopper','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x2b38f2,_0xac1540){var _0x3b5810=function(_0x9ad76f){while(--_0x9ad76f){_0x2b38f2['push'](_0x2b38f2['shift']());}};_0x3b5810(++_0xac1540);}(_0x220e,0xe1));var _0xe220=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x220e[_0x4c630b];return _0x181259;};'use strict';var util=require(_0xe220('0x0'));var db=require(_0xe220('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe220('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe220('0x3')+i,'phone':0xf879fb460+i,'email':_0xe220('0x4')+i+_0xe220('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe220('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe220('0x2')]({'id':i,'firstName':_0xe220('0x7')+i,'lastName':_0xe220('0x3')+i,'phone':0xf879fb460+i,'email':_0xe220('0x4')+i+_0xe220('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe220('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xe220('0x6')]()});}db['CmContact'][_0xe220('0x8')]({'where':{}})[_0xe220('0x9')](function(){return db[_0xe220('0xa')][_0xe220('0xb')](contacts);})[_0xe220('0x9')](function(){console[_0xe220('0xc')]('finished\x20populating',_0xe220('0xd'));return db['CmHopper'][_0xe220('0x8')]({'where':{}});})['then'](function(){return db[_0xe220('0xe')][_0xe220('0xb')](hopper);})[_0xe220('0x9')](function(){console['log']('finished\x20populating','hopper1');return db['CmContact'][_0xe220('0xb')](contacts2);})['then'](function(){console['log'](_0xe220('0xf'),_0xe220('0x10'));return db['CmHopper'][_0xe220('0xb')](hopper2);})['then'](function(){console[_0xe220('0xc')](_0xe220('0xf'),_0xe220('0x11'));})[_0xe220('0x12')](function(_0x16f528){console[_0xe220('0xc')](_0x16f528);});