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