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