84a6f3a441ac5336db444a9fb0ea8649e4327bf4
[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 _0x6e53=['hopper1','log','contacts2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','then','CmContact','finished\x20populating','contacts1','CmHopper','bulkCreate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e53,0x1df));var _0x36e5=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x6e53[_0x3f6bcf];return _0x1c5350;};'use strict';var util=require('util');var db=require(_0x36e5('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x36e5('0x1')]({'id':i,'firstName':_0x36e5('0x2')+i,'lastName':_0x36e5('0x3')+i,'phone':0xf879fb460+i,'email':_0x36e5('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x36e5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x36e5('0x5')](),'updatedAt':Date[_0x36e5('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x36e5('0x2')+i,'lastName':_0x36e5('0x3')+i,'phone':0xf879fb460+i,'email':_0x36e5('0x4')+i+_0x36e5('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x36e5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x36e5('0x5')](),'updatedAt':Date[_0x36e5('0x5')]()});}db['CmContact'][_0x36e5('0x7')]({'where':{}})[_0x36e5('0x8')](function(){return db[_0x36e5('0x9')]['bulkCreate'](contacts);})['then'](function(){console['log'](_0x36e5('0xa'),_0x36e5('0xb'));return db['CmHopper'][_0x36e5('0x7')]({'where':{}});})[_0x36e5('0x8')](function(){return db[_0x36e5('0xc')][_0x36e5('0xd')](hopper);})[_0x36e5('0x8')](function(){console['log'](_0x36e5('0xa'),_0x36e5('0xe'));return db[_0x36e5('0x9')][_0x36e5('0xd')](contacts2);})['then'](function(){console[_0x36e5('0xf')]('finished\x20populating',_0x36e5('0x10'));return db[_0x36e5('0xc')]['bulkCreate'](hopper2);})[_0x36e5('0x8')](function(){console[_0x36e5('0xf')](_0x36e5('0xa'),'hopper2');})['catch'](function(_0x1437a5){console[_0x36e5('0xf')](_0x1437a5);});