Built motion from commit (unavailable).|2.5.5
[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 _0xe907=['util','../mysqldb','Biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','contacts2','hopper2'];(function(_0xc9b5dd,_0x1f4bc4){var _0x2a6ee9=function(_0x13fc8b){while(--_0x13fc8b){_0xc9b5dd['push'](_0xc9b5dd['shift']());}};_0x2a6ee9(++_0x1f4bc4);}(_0xe907,0xa0));var _0x7e90=function(_0x110a71,_0x4a6bd2){_0x110a71=_0x110a71-0x0;var _0x4a08dc=_0xe907[_0x110a71];return _0x4a08dc;};'use strict';var util=require(_0x7e90('0x0'));var db=require(_0x7e90('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7e90('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7e90('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7e90('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x7e90('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7e90('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7e90('0x4')]({'id':i,'firstName':_0x7e90('0x6')+i,'lastName':_0x7e90('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7e90('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7e90('0x5')](),'updatedAt':Date[_0x7e90('0x5')]()});}db[_0x7e90('0x7')][_0x7e90('0x8')]({'where':{}})[_0x7e90('0x9')](function(){return db[_0x7e90('0x7')][_0x7e90('0xa')](contacts);})[_0x7e90('0x9')](function(){console[_0x7e90('0xb')](_0x7e90('0xc'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})[_0x7e90('0x9')](function(){return db[_0x7e90('0xd')][_0x7e90('0xa')](hopper);})['then'](function(){console['log'](_0x7e90('0xc'),'hopper1');return db[_0x7e90('0x7')][_0x7e90('0xa')](contacts2);})['then'](function(){console['log']('finished\x20populating',_0x7e90('0xe'));return db[_0x7e90('0xd')]['bulkCreate'](hopper2);})[_0x7e90('0x9')](function(){console[_0x7e90('0xb')]('finished\x20populating',_0x7e90('0xf'));})['catch'](function(_0x22323d){console[_0x7e90('0xb')](_0x22323d);});