Built motion from commit (unavailable).|2.0.76
[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 _0x8506=['../../components/auth/service','../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','create','put','delete','destroy','exports','util','express'];(function(_0x4e8a16,_0x404574){var _0x4ee1a3=function(_0x3cee25){while(--_0x3cee25){_0x4e8a16['push'](_0x4e8a16['shift']());}};_0x4ee1a3(++_0x404574);}(_0x8506,0xe8));var _0x6850=function(_0x37d370,_0x1898d7){_0x37d370=_0x37d370-0x0;var _0x4b6cd8=_0x8506[_0x37d370];return _0x4b6cd8;};'use strict';var multer=require('multer');var util=require(_0x6850('0x0'));var path=require('path');var express=require(_0x6850('0x1'));var router=express['Router']();var auth=require(_0x6850('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6850('0x3'));var controller=require(_0x6850('0x4'));router[_0x6850('0x5')]('/',auth['isAuthenticated'](),controller[_0x6850('0x6')]);router[_0x6850('0x5')](_0x6850('0x7'),auth[_0x6850('0x8')](),controller['show']);router['get']('/:id/download',auth[_0x6850('0x8')](),controller[_0x6850('0x9')]);var upload=multer({'storage':multer[_0x6850('0xa')]({'destination':function(_0x589417,_0x5abd3b,_0x50e0e9){_0x50e0e9(null,path[_0x6850('0xb')](config[_0x6850('0xc')],_0x6850('0xd')));},'filename':function(_0xa24cab,_0x5d712b,_0x16510e){_0x16510e(null,util[_0x6850('0xe')](_0x6850('0xf'),Date[_0x6850('0x10')](),_0x5d712b[_0x6850('0x11')][_0x6850('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x6850('0x13')](_0x6850('0x14')),controller[_0x6850('0x15')]);router[_0x6850('0x16')](_0x6850('0x7'),auth[_0x6850('0x8')](),controller['update']);router[_0x6850('0x17')]('/:id',auth[_0x6850('0x8')](),controller[_0x6850('0x18')]);module[_0x6850('0x19')]=router;