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