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