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