97f25984fd7af00700b6e1f95457e61b8093dc2c
[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 _0x352e=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','index','/:id','isAuthenticated','/:id/download','download','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','now','originalname','post','single','create','put','update'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x352e,0x1a6));var _0xe352=function(_0x2d0817,_0x830e22){_0x2d0817=_0x2d0817-0x0;var _0x2831dc=_0x352e[_0x2d0817];return _0x2831dc;};'use strict';var multer=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var path=require(_0xe352('0x2'));var timeout=require(_0xe352('0x3'));var express=require(_0xe352('0x4'));var router=express[_0xe352('0x5')]();var auth=require(_0xe352('0x6'));var interaction=require(_0xe352('0x7'));var config=require('../../config/environment');var controller=require(_0xe352('0x8'));router[_0xe352('0x9')]('/',auth['isAuthenticated'](),controller[_0xe352('0xa')]);router[_0xe352('0x9')](_0xe352('0xb'),auth[_0xe352('0xc')](),controller['show']);router[_0xe352('0x9')](_0xe352('0xd'),auth[_0xe352('0xc')](),controller[_0xe352('0xe')]);router['post'](_0xe352('0xf'),auth[_0xe352('0xc')](),controller[_0xe352('0x10')]);var upload=multer({'storage':multer[_0xe352('0x11')]({'destination':function(_0x3eb6c0,_0xd1a6af,_0x4b0b13){_0x4b0b13(null,path['join'](config[_0xe352('0x12')],_0xe352('0x13')));},'filename':function(_0x2b1695,_0x45a7cb,_0x26a803){_0x26a803(null,util[_0xe352('0x14')]('%s-%s',Date[_0xe352('0x15')](),_0x45a7cb[_0xe352('0x16')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe352('0x17')]('/',upload[_0xe352('0x18')]('file'),controller[_0xe352('0x19')]);router[_0xe352('0x1a')](_0xe352('0xb'),auth[_0xe352('0xc')](),controller[_0xe352('0x1b')]);router[_0xe352('0x1c')](_0xe352('0xb'),auth[_0xe352('0xc')](),controller['destroy']);module[_0xe352('0x1d')]=router;