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