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