3852d9150f30ed6246c3b3fdf354df8bb6d28ad6
[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 _0xc448=['bulkCreate','finished\x20populating','contacts1','CmHopper','destroy','log','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','push','then','CmContact'];(function(_0x3c255a,_0x29cb96){var _0x12930d=function(_0x3ef1ca){while(--_0x3ef1ca){_0x3c255a['push'](_0x3c255a['shift']());}};_0x12930d(++_0x29cb96);}(_0xc448,0x1b9));var _0x8c44=function(_0x4fe3eb,_0x49d94e){_0x4fe3eb=_0x4fe3eb-0x0;var _0x27a8ff=_0xc448[_0x4fe3eb];return _0x27a8ff;};'use strict';var util=require(_0x8c44('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':_0x8c44('0x1')+i,'lastName':_0x8c44('0x2')+i,'phone':0xf879fb460+i,'email':_0x8c44('0x3')+i+_0x8c44('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x8c44('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8c44('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8c44('0x1')+i,'lastName':_0x8c44('0x2')+i,'phone':0xf879fb460+i,'email':_0x8c44('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8c44('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8c44('0x5')](),'updatedAt':Date['now']()});}db['CmContact']['destroy']({'where':{}})[_0x8c44('0x7')](function(){return db[_0x8c44('0x8')][_0x8c44('0x9')](contacts);})[_0x8c44('0x7')](function(){console['log'](_0x8c44('0xa'),_0x8c44('0xb'));return db[_0x8c44('0xc')][_0x8c44('0xd')]({'where':{}});})[_0x8c44('0x7')](function(){return db[_0x8c44('0xc')][_0x8c44('0x9')](hopper);})[_0x8c44('0x7')](function(){console[_0x8c44('0xe')]('finished\x20populating','hopper1');return db[_0x8c44('0x8')][_0x8c44('0x9')](contacts2);})[_0x8c44('0x7')](function(){console[_0x8c44('0xe')](_0x8c44('0xa'),'contacts2');return db[_0x8c44('0xc')]['bulkCreate'](hopper2);})[_0x8c44('0x7')](function(){console[_0x8c44('0xe')](_0x8c44('0xa'),'hopper2');})['catch'](function(_0x2826c0){console[_0x8c44('0xe')](_0x2826c0);});