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