567c8a46f918448f7fcfeab48da80146062e3f90
[motion2.git] / server / api / chatInteraction / index.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 _0x6372=['/:id/close','close','/:id','tracked','destroy','delete','/:id/tags','removeTags','multer','path','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','download','post','create','/:id/vidaoo','diskStorage','join','root','format','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','chat','chatinteraction:addtags','addTags','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon'];(function(_0x1c8fb1,_0xb39e81){var _0x57f8e8=function(_0x53cc03){while(--_0x53cc03){_0x1c8fb1['push'](_0x1c8fb1['shift']());}};_0x57f8e8(++_0xb39e81);}(_0x6372,0x1b8));var _0x2637=function(_0xb3fc81,_0x16b3c1){_0xb3fc81=_0xb3fc81-0x0;var _0x29ed95=_0x6372[_0xb3fc81];return _0x29ed95;};'use strict';var multer=require(_0x2637('0x0'));var util=require('util');var path=require(_0x2637('0x1'));var timeout=require('connect-timeout');var express=require(_0x2637('0x2'));var router=express[_0x2637('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2637('0x4'));var config=require(_0x2637('0x5'));var controller=require(_0x2637('0x6'));router[_0x2637('0x7')]('/',auth[_0x2637('0x8')](),controller['index']);router[_0x2637('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2637('0x7')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x2637('0x9')]);router[_0x2637('0x7')](_0x2637('0xa'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x2637('0x7')](_0x2637('0xb'),auth[_0x2637('0x8')](),controller[_0x2637('0xc')]);router[_0x2637('0x7')](_0x2637('0xd'),auth[_0x2637('0xe')](),controller[_0x2637('0xf')]);router[_0x2637('0x7')]('/:id/download',auth[_0x2637('0x8')](),controller[_0x2637('0x10')]);router[_0x2637('0x11')]('/',auth['isAuthenticated'](),controller[_0x2637('0x12')]);router[_0x2637('0x11')](_0x2637('0x13'),auth[_0x2637('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x2637('0x14')]({'destination':function(_0x36023a,_0x3f69d9,_0xcf9bb3){_0xcf9bb3(null,path[_0x2637('0x15')](config[_0x2637('0x16')],'server/files/attachments/'));},'filename':function(_0x4868f4,_0x2bc8d9,_0x4c7ee4){_0x4c7ee4(null,util[_0x2637('0x17')](_0x2637('0x18'),Date[_0x2637('0x19')](),_0x2bc8d9['originalname'][_0x2637('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2637('0x11')](_0x2637('0x1b'),upload['single'](_0x2637('0x1c')),controller[_0x2637('0x1d')]);router[_0x2637('0x11')]('/:id/messages',auth[_0x2637('0xe')](),controller[_0x2637('0x1e')]);router[_0x2637('0x11')]('/:id/tags',auth[_0x2637('0x8')](),interaction['tracked'](_0x2637('0x1f'),_0x2637('0x20')),controller[_0x2637('0x21')]);router['put']('/:id',auth[_0x2637('0x8')](),interaction['tracked']('chat','chatinteraction:update'),controller[_0x2637('0x22')]);router[_0x2637('0x23')](_0x2637('0x24'),controller[_0x2637('0x25')]);router[_0x2637('0x23')](_0x2637('0x26'),auth[_0x2637('0xe')](),controller[_0x2637('0x27')]);router['put'](_0x2637('0x28'),controller[_0x2637('0x29')]);router['delete'](_0x2637('0x2a'),auth[_0x2637('0x8')](),interaction[_0x2637('0x2b')](_0x2637('0x1f'),'chatinteraction:destroy'),controller[_0x2637('0x2c')]);router[_0x2637('0x2d')](_0x2637('0x2e'),auth[_0x2637('0x8')](),controller[_0x2637('0x2f')]);module['exports']=router;