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