4656e974802e5db41b5bc91ded85fb2d1d4fb94c
[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 _0x760f=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate'];(function(_0x533ca6,_0x4ed3fb){var _0x34f0bd=function(_0x2cc877){while(--_0x2cc877){_0x533ca6['push'](_0x533ca6['shift']());}};_0x34f0bd(++_0x4ed3fb);}(_0x760f,0xd2));var _0xf760=function(_0x395614,_0x4ad2b5){_0x395614=_0x395614-0x0;var _0x3f75fd=_0x760f[_0x395614];return _0x3f75fd;};'use strict';var util=require('util');var db=require(_0xf760('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf760('0x1')]({'id':i,'firstName':_0xf760('0x2')+i,'lastName':_0xf760('0x3')+i,'phone':0xf879fb460+i,'email':_0xf760('0x4')+i+_0xf760('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf760('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf760('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf760('0x6')](),'updatedAt':Date[_0xf760('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf760('0x2')+i,'lastName':_0xf760('0x3')+i,'phone':0xf879fb460+i,'email':_0xf760('0x4')+i+_0xf760('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf760('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf760('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf760('0x6')](),'updatedAt':Date[_0xf760('0x6')]()});}db[_0xf760('0x7')][_0xf760('0x8')]({'where':{}})[_0xf760('0x9')](function(){return db[_0xf760('0x7')][_0xf760('0xa')](contacts);})[_0xf760('0x9')](function(){console[_0xf760('0xb')](_0xf760('0xc'),_0xf760('0xd'));return db[_0xf760('0xe')][_0xf760('0x8')]({'where':{}});})[_0xf760('0x9')](function(){return db[_0xf760('0xe')][_0xf760('0xa')](hopper);})[_0xf760('0x9')](function(){console['log']('finished\x20populating',_0xf760('0xf'));return db[_0xf760('0x7')]['bulkCreate'](contacts2);})['then'](function(){console['log']('finished\x20populating',_0xf760('0x10'));return db[_0xf760('0xe')][_0xf760('0xa')](hopper2);})[_0xf760('0x9')](function(){console[_0xf760('0xb')]('finished\x20populating','hopper2');})['catch'](function(_0xabf035){console['log'](_0xabf035);});