2ed7af104674a290b90edebfb226bbb649670e37
[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 _0xa7b5=['download','post','clone','join','root','server/files/attachments/','format','%s-%s','originalname','replace','single','create','put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x1bfdfa,_0x35dfed){var _0x1d72ea=function(_0x27c130){while(--_0x27c130){_0x1bfdfa['push'](_0x1bfdfa['shift']());}};_0x1d72ea(++_0x35dfed);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x37244f,_0xee2bba){_0x37244f=_0x37244f-0x0;var _0x5ea2ca=_0xa7b5[_0x37244f];return _0x5ea2ca;};'use strict';var multer=require(_0x5a7b('0x0'));var util=require('util');var path=require(_0x5a7b('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a7b('0x2'));var router=express[_0x5a7b('0x3')]();var auth=require(_0x5a7b('0x4'));var interaction=require(_0x5a7b('0x5'));var config=require(_0x5a7b('0x6'));var controller=require(_0x5a7b('0x7'));router[_0x5a7b('0x8')]('/',auth[_0x5a7b('0x9')](),controller[_0x5a7b('0xa')]);router[_0x5a7b('0x8')](_0x5a7b('0xb'),auth[_0x5a7b('0x9')](),controller[_0x5a7b('0xc')]);router[_0x5a7b('0x8')](_0x5a7b('0xd'),auth[_0x5a7b('0x9')](),controller[_0x5a7b('0xe')]);router[_0x5a7b('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x5a7b('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfd7963,_0xe679a2,_0x321331){_0x321331(null,path[_0x5a7b('0x11')](config[_0x5a7b('0x12')],_0x5a7b('0x13')));},'filename':function(_0x2a5619,_0x156031,_0x11ac57){_0x11ac57(null,util[_0x5a7b('0x14')](_0x5a7b('0x15'),Date['now'](),_0x156031[_0x5a7b('0x16')][_0x5a7b('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5a7b('0xf')]('/',upload[_0x5a7b('0x18')]('file'),controller[_0x5a7b('0x19')]);router[_0x5a7b('0x1a')]('/:id',auth[_0x5a7b('0x9')](),controller['update']);router[_0x5a7b('0x1b')]('/:id',auth[_0x5a7b('0x9')](),controller[_0x5a7b('0x1c')]);module[_0x5a7b('0x1d')]=router;