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