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