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