462275b6a94ee5ebf0e4f8a797ac0b47f3dcb5be
[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 _0x3953=['then','CmContact','bulkCreate','finished\x20populating','CmHopper','log','hopper1','contacts2','hopper2','catch','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','destroy'];(function(_0x2539ce,_0x3850f0){var _0x561388=function(_0x3cc2c7){while(--_0x3cc2c7){_0x2539ce['push'](_0x2539ce['shift']());}};_0x561388(++_0x3850f0);}(_0x3953,0xe7));var _0x3395=function(_0x51701b,_0x50777d){_0x51701b=_0x51701b-0x0;var _0x4c58f9=_0x3953[_0x51701b];return _0x4c58f9;};'use strict';var util=require('util');var db=require('../mysqldb')['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':_0x3395('0x0')+i,'phone':0xf879fb460+i,'email':_0x3395('0x1')+i+_0x3395('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3395('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x3395('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3395('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3395('0x3')]({'id':i,'firstName':_0x3395('0x5')+i,'lastName':_0x3395('0x0')+i,'phone':0xf879fb460+i,'email':_0x3395('0x1')+i+_0x3395('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3395('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x3395('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3395('0x4')](),'updatedAt':Date[_0x3395('0x4')]()});}db['CmContact'][_0x3395('0x6')]({'where':{}})[_0x3395('0x7')](function(){return db[_0x3395('0x8')][_0x3395('0x9')](contacts);})[_0x3395('0x7')](function(){console['log'](_0x3395('0xa'),'contacts1');return db[_0x3395('0xb')][_0x3395('0x6')]({'where':{}});})[_0x3395('0x7')](function(){return db[_0x3395('0xb')]['bulkCreate'](hopper);})['then'](function(){console[_0x3395('0xc')](_0x3395('0xa'),_0x3395('0xd'));return db[_0x3395('0x8')][_0x3395('0x9')](contacts2);})[_0x3395('0x7')](function(){console['log']('finished\x20populating',_0x3395('0xe'));return db[_0x3395('0xb')][_0x3395('0x9')](hopper2);})[_0x3395('0x7')](function(){console[_0x3395('0xc')](_0x3395('0xa'),_0x3395('0xf'));})[_0x3395('0x10')](function(_0x279965){console[_0x3395('0xc')](_0x279965);});