Built motion from commit 3e059bc2.|2.5.32
[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 _0xed77=['CmHopper','contacts2','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0x3643b2,_0x3201bc){var _0x16c1b7=function(_0xb75fd5){while(--_0xb75fd5){_0x3643b2['push'](_0x3643b2['shift']());}};_0x16c1b7(++_0x3201bc);}(_0xed77,0x82));var _0x7ed7=function(_0xfceb8a,_0x139630){_0xfceb8a=_0xfceb8a-0x0;var _0x413fa7=_0xed77[_0xfceb8a];return _0x413fa7;};'use strict';var util=require('util');var db=require(_0x7ed7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7ed7('0x1')]({'id':i,'firstName':_0x7ed7('0x2')+i,'lastName':_0x7ed7('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7ed7('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7ed7('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7ed7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ed7('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7ed7('0x2')+i,'lastName':_0x7ed7('0x3')+i,'phone':0xf879fb460+i,'email':_0x7ed7('0x6')+i+_0x7ed7('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x7ed7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ed7('0x5')]()});}db[_0x7ed7('0x7')][_0x7ed7('0x8')]({'where':{}})[_0x7ed7('0x9')](function(){return db['CmContact'][_0x7ed7('0xa')](contacts);})['then'](function(){console[_0x7ed7('0xb')](_0x7ed7('0xc'),_0x7ed7('0xd'));return db[_0x7ed7('0xe')]['destroy']({'where':{}});})['then'](function(){return db['CmHopper'][_0x7ed7('0xa')](hopper);})['then'](function(){console[_0x7ed7('0xb')](_0x7ed7('0xc'),'hopper1');return db[_0x7ed7('0x7')]['bulkCreate'](contacts2);})['then'](function(){console['log']('finished\x20populating',_0x7ed7('0xf'));return db[_0x7ed7('0xe')][_0x7ed7('0xa')](hopper2);})[_0x7ed7('0x9')](function(){console['log'](_0x7ed7('0xc'),_0x7ed7('0x10'));})[_0x7ed7('0x11')](function(_0x35ae51){console[_0x7ed7('0xb')](_0x35ae51);});