511bc881c7a60a938c89b1a33611728140738dd1
[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 _0x8a4f=['now','push','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x4406ac,_0x271458){var _0xc8abd=function(_0x5705d8){while(--_0x5705d8){_0x4406ac['push'](_0x4406ac['shift']());}};_0xc8abd(++_0x271458);}(_0x8a4f,0x1e9));var _0xf8a4=function(_0x157fce,_0xfd8961){_0x157fce=_0x157fce-0x0;var _0x190d5f=_0x8a4f[_0x157fce];return _0x190d5f;};'use strict';var util=require(_0xf8a4('0x0'));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':_0xf8a4('0x1')+i,'lastName':_0xf8a4('0x2')+i,'phone':0xf879fb460+i,'email':_0xf8a4('0x3')+i+_0xf8a4('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf8a4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf8a4('0x5')](),'updatedAt':Date[_0xf8a4('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf8a4('0x6')]({'id':i,'firstName':_0xf8a4('0x1')+i,'lastName':_0xf8a4('0x2')+i,'phone':0xf879fb460+i,'email':_0xf8a4('0x3')+i+_0xf8a4('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf8a4('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xf8a4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf8a4('0x5')](),'updatedAt':Date[_0xf8a4('0x5')]()});}db[_0xf8a4('0x7')][_0xf8a4('0x8')]({'where':{}})[_0xf8a4('0x9')](function(){return db[_0xf8a4('0x7')][_0xf8a4('0xa')](contacts);})[_0xf8a4('0x9')](function(){console[_0xf8a4('0xb')](_0xf8a4('0xc'),_0xf8a4('0xd'));return db[_0xf8a4('0xe')][_0xf8a4('0x8')]({'where':{}});})[_0xf8a4('0x9')](function(){return db[_0xf8a4('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0xf8a4('0xb')](_0xf8a4('0xc'),_0xf8a4('0xf'));return db['CmContact']['bulkCreate'](contacts2);})[_0xf8a4('0x9')](function(){console['log'](_0xf8a4('0xc'),_0xf8a4('0x10'));return db['CmHopper'][_0xf8a4('0xa')](hopper2);})[_0xf8a4('0x9')](function(){console[_0xf8a4('0xb')](_0xf8a4('0xc'),_0xf8a4('0x11'));})[_0xf8a4('0x12')](function(_0x3361d7){console[_0xf8a4('0xb')](_0x3361d7);});