3c20ba2c1d0fd2ed7590883a389b3dc53f3e5177
[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 _0x639a=['get','index','/:id','isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./attachment.controller'];(function(_0x554651,_0x33b329){var _0x53fb5a=function(_0x1f8b0a){while(--_0x1f8b0a){_0x554651['push'](_0x554651['shift']());}};_0x53fb5a(++_0x33b329);}(_0x639a,0x1e8));var _0xa639=function(_0x39abd5,_0x170067){_0x39abd5=_0x39abd5-0x0;var _0x13cce2=_0x639a[_0x39abd5];return _0x13cce2;};'use strict';var multer=require(_0xa639('0x0'));var util=require(_0xa639('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa639('0x2'));var router=express[_0xa639('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa639('0x4'));var config=require(_0xa639('0x5'));var controller=require(_0xa639('0x6'));router[_0xa639('0x7')]('/',auth['isAuthenticated'](),controller[_0xa639('0x8')]);router['get'](_0xa639('0x9'),auth[_0xa639('0xa')](),controller[_0xa639('0xb')]);router[_0xa639('0x7')](_0xa639('0xc'),auth['isAuthenticated'](),controller[_0xa639('0xd')]);router[_0xa639('0xe')](_0xa639('0xf'),auth['isAuthenticated'](),controller[_0xa639('0x10')]);var upload=multer({'storage':multer[_0xa639('0x11')]({'destination':function(_0x5a96fb,_0x34a5b1,_0x45b789){_0x45b789(null,path['join'](config[_0xa639('0x12')],_0xa639('0x13')));},'filename':function(_0x51e76a,_0x450aa7,_0x1a666e){_0x1a666e(null,util[_0xa639('0x14')](_0xa639('0x15'),Date[_0xa639('0x16')](),_0x450aa7[_0xa639('0x17')][_0xa639('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xa639('0x19')](_0xa639('0x1a')),controller[_0xa639('0x1b')]);router[_0xa639('0x1c')](_0xa639('0x9'),auth[_0xa639('0xa')](),controller[_0xa639('0x1d')]);router[_0xa639('0x1e')](_0xa639('0x9'),auth['isAuthenticated'](),controller[_0xa639('0x1f')]);module[_0xa639('0x20')]=router;