06fd458f12cee1f59652a0b4ae6c127a4bd947c0
[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 _0x5b12=['originalname','replace','single','file','put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./attachment.controller','index','isAuthenticated','show','get','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x5b12,0xa3));var _0x25b1=function(_0x2eddb4,_0x3d08cf){_0x2eddb4=_0x2eddb4-0x0;var _0x17d272=_0x5b12[_0x2eddb4];return _0x17d272;};'use strict';var multer=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x25b1('0x3'));var router=express['Router']();var auth=require(_0x25b1('0x4'));var interaction=require(_0x25b1('0x5'));var config=require('../../config/environment');var controller=require(_0x25b1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x25b1('0x7')]);router['get']('/:id',auth[_0x25b1('0x8')](),controller[_0x25b1('0x9')]);router[_0x25b1('0xa')](_0x25b1('0xb'),auth[_0x25b1('0x8')](),controller[_0x25b1('0xc')]);router[_0x25b1('0xd')](_0x25b1('0xe'),auth['isAuthenticated'](),controller[_0x25b1('0xf')]);var upload=multer({'storage':multer[_0x25b1('0x10')]({'destination':function(_0x2cee35,_0x34abe5,_0x37822f){_0x37822f(null,path[_0x25b1('0x11')](config[_0x25b1('0x12')],_0x25b1('0x13')));},'filename':function(_0x90a241,_0x459070,_0xbdd348){_0xbdd348(null,util[_0x25b1('0x14')](_0x25b1('0x15'),Date[_0x25b1('0x16')](),_0x459070[_0x25b1('0x17')][_0x25b1('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x25b1('0x19')](_0x25b1('0x1a')),controller['create']);router[_0x25b1('0x1b')](_0x25b1('0x1c'),auth[_0x25b1('0x8')](),controller['update']);router['delete'](_0x25b1('0x1c'),auth['isAuthenticated'](),controller[_0x25b1('0x1d')]);module[_0x25b1('0x1e')]=router;