2b39e6922804d6795b9a325d4e587d92dc62b20a
[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 _0x8a3c=['Innocenzo','CmContact','then','finished\x20populating','CmHopper','destroy','bulkCreate','log','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x3e0674,_0x4db90b){var _0x2c204a=function(_0x41cdf7){while(--_0x41cdf7){_0x3e0674['push'](_0x3e0674['shift']());}};_0x2c204a(++_0x4db90b);}(_0x8a3c,0x19d));var _0xc8a3=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x8a3c[_0x461886];return _0x295e0a;};'use strict';var util=require(_0xc8a3('0x0'));var db=require(_0xc8a3('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc8a3('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc8a3('0x3')+i,'phone':0xf879fb460+i,'email':_0xc8a3('0x4')+i+_0xc8a3('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc8a3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc8a3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc8a3('0x6')](),'updatedAt':Date[_0xc8a3('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc8a3('0x2')]({'id':i,'firstName':_0xc8a3('0x7')+i,'lastName':_0xc8a3('0x3')+i,'phone':0xf879fb460+i,'email':_0xc8a3('0x4')+i+_0xc8a3('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc8a3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc8a3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc8a3('0x6')]()});}db[_0xc8a3('0x8')]['destroy']({'where':{}})[_0xc8a3('0x9')](function(){return db[_0xc8a3('0x8')]['bulkCreate'](contacts);})[_0xc8a3('0x9')](function(){console['log'](_0xc8a3('0xa'),'contacts1');return db[_0xc8a3('0xb')][_0xc8a3('0xc')]({'where':{}});})[_0xc8a3('0x9')](function(){return db[_0xc8a3('0xb')][_0xc8a3('0xd')](hopper);})[_0xc8a3('0x9')](function(){console[_0xc8a3('0xe')]('finished\x20populating','hopper1');return db['CmContact'][_0xc8a3('0xd')](contacts2);})[_0xc8a3('0x9')](function(){console[_0xc8a3('0xe')](_0xc8a3('0xa'),'contacts2');return db[_0xc8a3('0xb')]['bulkCreate'](hopper2);})[_0xc8a3('0x9')](function(){console[_0xc8a3('0xe')]('finished\x20populating','hopper2');})['catch'](function(_0x17a216){console[_0xc8a3('0xe')](_0x17a216);});