0ba841ddba95adb4ef03467847af3b9928b0baae
[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 _0x32e7=['originalname','file','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','/:id','isAuthenticated','get','/:id/download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x32e7,0xc3));var _0x732e=function(_0x1d84eb,_0x23aa40){_0x1d84eb=_0x1d84eb-0x0;var _0x46dfd7=_0x32e7[_0x1d84eb];return _0x46dfd7;};'use strict';var multer=require(_0x732e('0x0'));var util=require('util');var path=require(_0x732e('0x1'));var timeout=require(_0x732e('0x2'));var express=require(_0x732e('0x3'));var router=express['Router']();var auth=require(_0x732e('0x4'));var interaction=require(_0x732e('0x5'));var config=require(_0x732e('0x6'));var controller=require(_0x732e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x732e('0x8')]);router['get'](_0x732e('0x9'),auth[_0x732e('0xa')](),controller['show']);router[_0x732e('0xb')](_0x732e('0xc'),auth[_0x732e('0xa')](),controller['download']);router[_0x732e('0xd')]('/:id/clone',auth[_0x732e('0xa')](),controller[_0x732e('0xe')]);var upload=multer({'storage':multer[_0x732e('0xf')]({'destination':function(_0x264581,_0x1518e3,_0x4e53fb){_0x4e53fb(null,path[_0x732e('0x10')](config[_0x732e('0x11')],_0x732e('0x12')));},'filename':function(_0x2236eb,_0x5982c4,_0x1a33d9){_0x1a33d9(null,util[_0x732e('0x13')](_0x732e('0x14'),Date['now'](),_0x5982c4[_0x732e('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x732e('0xd')]('/',upload['single'](_0x732e('0x16')),controller['create']);router['put'](_0x732e('0x9'),auth[_0x732e('0xa')](),controller[_0x732e('0x17')]);router[_0x732e('0x18')](_0x732e('0x9'),auth[_0x732e('0xa')](),controller[_0x732e('0x19')]);module[_0x732e('0x1a')]=router;