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