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