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