Built motion from commit 52c8a02d.|2.6.29
[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 _0x9dd7=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','Biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log'];(function(_0x587e48,_0x2d87cd){var _0x16cbb0=function(_0xd670ba){while(--_0xd670ba){_0x587e48['push'](_0x587e48['shift']());}};_0x16cbb0(++_0x2d87cd);}(_0x9dd7,0x1bf));var _0x79dd=function(_0x38bf2c,_0x47187a){_0x38bf2c=_0x38bf2c-0x0;var _0x546d4a=_0x9dd7[_0x38bf2c];return _0x546d4a;};'use strict';var util=require(_0x79dd('0x0'));var db=require(_0x79dd('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x79dd('0x2')]({'id':i,'firstName':_0x79dd('0x3')+i,'lastName':_0x79dd('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x79dd('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x79dd('0x5')](),'updatedAt':Date[_0x79dd('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x79dd('0x3')+i,'lastName':_0x79dd('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x79dd('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x79dd('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x79dd('0x5')](),'updatedAt':Date[_0x79dd('0x5')]()});}db[_0x79dd('0x7')][_0x79dd('0x8')]({'where':{}})[_0x79dd('0x9')](function(){return db['CmContact'][_0x79dd('0xa')](contacts);})[_0x79dd('0x9')](function(){console[_0x79dd('0xb')](_0x79dd('0xc'),_0x79dd('0xd'));return db['CmHopper'][_0x79dd('0x8')]({'where':{}});})['then'](function(){return db[_0x79dd('0xe')]['bulkCreate'](hopper);})[_0x79dd('0x9')](function(){console[_0x79dd('0xb')](_0x79dd('0xc'),_0x79dd('0xf'));return db['CmContact']['bulkCreate'](contacts2);})[_0x79dd('0x9')](function(){console[_0x79dd('0xb')]('finished\x20populating',_0x79dd('0x10'));return db['CmHopper'][_0x79dd('0xa')](hopper2);})[_0x79dd('0x9')](function(){console[_0x79dd('0xb')](_0x79dd('0xc'),'hopper2');})['catch'](function(_0x4e6d2e){console['log'](_0x4e6d2e);});