8629e4ceefaba1c84d8a199fedef0779afa5bd78
[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 _0x0137=['./attachment.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','/:id/clone','diskStorage','join','root','format','%s-%s','now','originalname','replace','single','file','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0137,0x1d8));var _0x7013=function(_0x48317f,_0x12895a){_0x48317f=_0x48317f-0x0;var _0x4d1cce=_0x0137[_0x48317f];return _0x4d1cce;};'use strict';var multer=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var path=require(_0x7013('0x2'));var timeout=require(_0x7013('0x3'));var express=require(_0x7013('0x4'));var router=express['Router']();var auth=require(_0x7013('0x5'));var interaction=require(_0x7013('0x6'));var config=require(_0x7013('0x7'));var controller=require(_0x7013('0x8'));router[_0x7013('0x9')]('/',auth[_0x7013('0xa')](),controller['index']);router[_0x7013('0x9')](_0x7013('0xb'),auth['isAuthenticated'](),controller[_0x7013('0xc')]);router[_0x7013('0x9')](_0x7013('0xd'),auth['isAuthenticated'](),controller[_0x7013('0xe')]);router[_0x7013('0xf')](_0x7013('0x10'),auth[_0x7013('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x7013('0x11')]({'destination':function(_0x2b74b3,_0x1a8995,_0x2f629d){_0x2f629d(null,path[_0x7013('0x12')](config[_0x7013('0x13')],'server/files/attachments/'));},'filename':function(_0x17a466,_0x3ea7f0,_0x2a91b8){_0x2a91b8(null,util[_0x7013('0x14')](_0x7013('0x15'),Date[_0x7013('0x16')](),_0x3ea7f0[_0x7013('0x17')][_0x7013('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7013('0xf')]('/',upload[_0x7013('0x19')](_0x7013('0x1a')),controller['create']);router['put'](_0x7013('0xb'),auth[_0x7013('0xa')](),controller[_0x7013('0x1b')]);router[_0x7013('0x1c')](_0x7013('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7013('0x1d')]=router;