317610d6c510aaf6741b5f029aff14bb11ba4540
[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 _0xe01c=['now','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xe01c,0x1f2));var _0xce01=function(_0x16990f,_0x66dccd){_0x16990f=_0x16990f-0x0;var _0x4efc92=_0xe01c[_0x16990f];return _0x4efc92;};'use strict';var util=require(_0xce01('0x0'));var db=require(_0xce01('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce01('0x2')]({'id':i,'firstName':_0xce01('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xce01('0x4')+i+_0xce01('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xce01('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce01('0x6')](),'updatedAt':Date[_0xce01('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xce01('0x7')+i,'phone':0xf879fb460+i,'email':_0xce01('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xce01('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xce01('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xce01('0x6')]()});}db[_0xce01('0x8')][_0xce01('0x9')]({'where':{}})[_0xce01('0xa')](function(){return db[_0xce01('0x8')][_0xce01('0xb')](contacts);})['then'](function(){console[_0xce01('0xc')](_0xce01('0xd'),_0xce01('0xe'));return db[_0xce01('0xf')][_0xce01('0x9')]({'where':{}});})[_0xce01('0xa')](function(){return db[_0xce01('0xf')][_0xce01('0xb')](hopper);})[_0xce01('0xa')](function(){console['log'](_0xce01('0xd'),_0xce01('0x10'));return db[_0xce01('0x8')][_0xce01('0xb')](contacts2);})[_0xce01('0xa')](function(){console['log']('finished\x20populating',_0xce01('0x11'));return db[_0xce01('0xf')]['bulkCreate'](hopper2);})[_0xce01('0xa')](function(){console[_0xce01('0xc')](_0xce01('0xd'),'hopper2');})['catch'](function(_0x186708){console[_0xce01('0xc')](_0x186708);});