259dc0705e8982386895cb6377392c9852945fab
[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 _0xe00c=['util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','log','destroy','CmHopper','then','finished\x20populating','hopper1','hopper2','catch'];(function(_0x569cf3,_0x4b3d5a){var _0xf9e9a2=function(_0x273b17){while(--_0x273b17){_0x569cf3['push'](_0x569cf3['shift']());}};_0xf9e9a2(++_0x4b3d5a);}(_0xe00c,0x165));var _0xce00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe00c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xce00('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce00('0x1')]({'id':i,'firstName':_0xce00('0x2')+i,'lastName':_0xce00('0x3')+i,'phone':0xf879fb460+i,'email':_0xce00('0x4')+i+_0xce00('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xce00('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xce00('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce00('0x6')](),'updatedAt':Date[_0xce00('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xce00('0x1')]({'id':i,'firstName':_0xce00('0x2')+i,'lastName':_0xce00('0x3')+i,'phone':0xf879fb460+i,'email':_0xce00('0x4')+i+_0xce00('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xce00('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xce00('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce00('0x6')](),'updatedAt':Date[_0xce00('0x6')]()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0xce00('0x7')][_0xce00('0x8')](contacts);})['then'](function(){console[_0xce00('0x9')]('finished\x20populating','contacts1');return db['CmHopper'][_0xce00('0xa')]({'where':{}});})['then'](function(){return db[_0xce00('0xb')][_0xce00('0x8')](hopper);})[_0xce00('0xc')](function(){console[_0xce00('0x9')](_0xce00('0xd'),_0xce00('0xe'));return db[_0xce00('0x7')][_0xce00('0x8')](contacts2);})[_0xce00('0xc')](function(){console['log']('finished\x20populating','contacts2');return db[_0xce00('0xb')]['bulkCreate'](hopper2);})[_0xce00('0xc')](function(){console[_0xce00('0x9')](_0xce00('0xd'),_0xce00('0xf'));})[_0xce00('0x10')](function(_0x27e42e){console[_0xce00('0x9')](_0x27e42e);});