Built motion from commit (unavailable).|2.4.18
[motion2.git] / server / api / attachment / 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 _0xcd78=['delete','multer','util','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','/:id/download','isAuthenticated','download','clone','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','single','create','put'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcd78,0xa9));var _0x8cd7=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0xcd78[_0xea1570];return _0x579e74;};'use strict';var multer=require(_0x8cd7('0x0'));var util=require(_0x8cd7('0x1'));var path=require('path');var timeout=require(_0x8cd7('0x2'));var express=require(_0x8cd7('0x3'));var router=express[_0x8cd7('0x4')]();var auth=require(_0x8cd7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x8cd7('0x6')]('/',auth['isAuthenticated'](),controller[_0x8cd7('0x7')]);router[_0x8cd7('0x6')](_0x8cd7('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8cd7('0x9'),auth[_0x8cd7('0xa')](),controller[_0x8cd7('0xb')]);router['post']('/:id/clone',auth[_0x8cd7('0xa')](),controller[_0x8cd7('0xc')]);var upload=multer({'storage':multer[_0x8cd7('0xd')]({'destination':function(_0x49caa3,_0x4d4bde,_0x49ac1f){_0x49ac1f(null,path['join'](config[_0x8cd7('0xe')],_0x8cd7('0xf')));},'filename':function(_0x31d3c8,_0x1e1816,_0x2d6488){_0x2d6488(null,util[_0x8cd7('0x10')](_0x8cd7('0x11'),Date['now'](),_0x1e1816[_0x8cd7('0x12')][_0x8cd7('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x8cd7('0x14')]('file'),controller[_0x8cd7('0x15')]);router[_0x8cd7('0x16')](_0x8cd7('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x8cd7('0x17')](_0x8cd7('0x8'),auth[_0x8cd7('0xa')](),controller['destroy']);module['exports']=router;