5439db88295b07f54b89955edb8ce2694d8a5ee4
[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 _0x97e6=['single','file','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','get','/:id','show','download','post','clone','diskStorage','join','%s-%s','now'];(function(_0x3391fe,_0x5c24d9){var _0x1ae383=function(_0x5e71a4){while(--_0x5e71a4){_0x3391fe['push'](_0x3391fe['shift']());}};_0x1ae383(++_0x5c24d9);}(_0x97e6,0x159));var _0x697e=function(_0x2f4e7a,_0x4c3f4e){_0x2f4e7a=_0x2f4e7a-0x0;var _0x3299a0=_0x97e6[_0x2f4e7a];return _0x3299a0;};'use strict';var multer=require(_0x697e('0x0'));var util=require('util');var path=require(_0x697e('0x1'));var timeout=require(_0x697e('0x2'));var express=require(_0x697e('0x3'));var router=express['Router']();var auth=require(_0x697e('0x4'));var interaction=require(_0x697e('0x5'));var config=require('../../config/environment');var controller=require(_0x697e('0x6'));router['get']('/',auth[_0x697e('0x7')](),controller[_0x697e('0x8')]);router[_0x697e('0x9')](_0x697e('0xa'),auth[_0x697e('0x7')](),controller[_0x697e('0xb')]);router['get']('/:id/download',auth[_0x697e('0x7')](),controller[_0x697e('0xc')]);router[_0x697e('0xd')]('/:id/clone',auth[_0x697e('0x7')](),controller[_0x697e('0xe')]);var upload=multer({'storage':multer[_0x697e('0xf')]({'destination':function(_0x1c7aa7,_0x3c528a,_0x4d0570){_0x4d0570(null,path[_0x697e('0x10')](config['root'],'server/files/attachments/'));},'filename':function(_0x11d502,_0x381c9d,_0x1aa4bb){_0x1aa4bb(null,util['format'](_0x697e('0x11'),Date[_0x697e('0x12')](),_0x381c9d['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x697e('0xd')]('/',upload[_0x697e('0x13')](_0x697e('0x14')),controller[_0x697e('0x15')]);router[_0x697e('0x16')](_0x697e('0xa'),auth[_0x697e('0x7')](),controller[_0x697e('0x17')]);router[_0x697e('0x18')]('/:id',auth[_0x697e('0x7')](),controller[_0x697e('0x19')]);module['exports']=router;