599cf06c87a0bb112e9268e437376455d4044c4b
[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 _0x0b59=['/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','post','/:id/tags','chatinteraction:addtags','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','get','/:id/my_messages','/:id/download','download'];(function(_0x532c55,_0x4dab9a){var _0x1eefe9=function(_0x13b8cb){while(--_0x13b8cb){_0x532c55['push'](_0x532c55['shift']());}};_0x1eefe9(++_0x4dab9a);}(_0x0b59,0x1c7));var _0x90b5=function(_0x587d78,_0x179cfb){_0x587d78=_0x587d78-0x0;var _0x465676=_0x0b59[_0x587d78];return _0x465676;};'use strict';var multer=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var path=require(_0x90b5('0x2'));var timeout=require(_0x90b5('0x3'));var express=require(_0x90b5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90b5('0x5'));var interaction=require(_0x90b5('0x6'));var config=require(_0x90b5('0x7'));var controller=require(_0x90b5('0x8'));router['get']('/',auth[_0x90b5('0x9')](),controller[_0x90b5('0xa')]);router['get'](_0x90b5('0xb'),auth[_0x90b5('0x9')](),controller[_0x90b5('0xc')]);router['get'](_0x90b5('0xd'),auth[_0x90b5('0xe')](),controller[_0x90b5('0xf')]);router['get'](_0x90b5('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x90b5('0x11')]);router['get']('/:id/messages',auth[_0x90b5('0x9')](),controller['getMessages']);router[_0x90b5('0x12')](_0x90b5('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x90b5('0x12')](_0x90b5('0x14'),auth[_0x90b5('0x9')](),controller[_0x90b5('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x90b5('0x16'),auth[_0x90b5('0x9')](),controller[_0x90b5('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x296ec7,_0x55303e,_0x477390){_0x477390(null,path[_0x90b5('0x18')](config[_0x90b5('0x19')],_0x90b5('0x1a')));},'filename':function(_0x182e03,_0x412727,_0x4cc7e3){_0x4cc7e3(null,util[_0x90b5('0x1b')](_0x90b5('0x1c'),Date[_0x90b5('0x1d')](),_0x412727[_0x90b5('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x90b5('0x1f'),upload[_0x90b5('0x20')](_0x90b5('0x21')),controller[_0x90b5('0x22')]);router['post'](_0x90b5('0x23'),auth[_0x90b5('0xe')](),controller[_0x90b5('0x24')]);router[_0x90b5('0x25')](_0x90b5('0x26'),auth[_0x90b5('0x9')](),interaction['tracked']('chat',_0x90b5('0x27')),controller['addTags']);router['put'](_0x90b5('0xd'),auth[_0x90b5('0x9')](),interaction['tracked'](_0x90b5('0x28'),_0x90b5('0x29')),controller[_0x90b5('0x2a')]);router[_0x90b5('0x2b')]('/:id/custom_update',controller[_0x90b5('0x2c')]);router[_0x90b5('0x2b')](_0x90b5('0x2d'),auth[_0x90b5('0xe')](),controller[_0x90b5('0x2e')]);router[_0x90b5('0x2b')](_0x90b5('0x2f'),controller[_0x90b5('0x30')]);router[_0x90b5('0x31')]('/:id',auth[_0x90b5('0x9')](),interaction[_0x90b5('0x32')](_0x90b5('0x28'),'chatinteraction:destroy'),controller['destroy']);router[_0x90b5('0x31')](_0x90b5('0x26'),auth[_0x90b5('0x9')](),controller[_0x90b5('0x33')]);module[_0x90b5('0x34')]=router;