70f2a07ad5c6de645322ff1bda034201fc8ef7e9
[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 _0x96f2=['post','/:id/clone','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','put','update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download'];(function(_0x54c17a,_0x480446){var _0x5f0254=function(_0x302af8){while(--_0x302af8){_0x54c17a['push'](_0x54c17a['shift']());}};_0x5f0254(++_0x480446);}(_0x96f2,0xb0));var _0x296f=function(_0x2a601a,_0x2e6a11){_0x2a601a=_0x2a601a-0x0;var _0x1e1af8=_0x96f2[_0x2a601a];return _0x1e1af8;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require(_0x296f('0x2'));var express=require(_0x296f('0x3'));var router=express['Router']();var auth=require(_0x296f('0x4'));var interaction=require(_0x296f('0x5'));var config=require(_0x296f('0x6'));var controller=require('./attachment.controller');router[_0x296f('0x7')]('/',auth[_0x296f('0x8')](),controller['index']);router['get'](_0x296f('0x9'),auth[_0x296f('0x8')](),controller[_0x296f('0xa')]);router[_0x296f('0x7')](_0x296f('0xb'),auth[_0x296f('0x8')](),controller[_0x296f('0xc')]);router[_0x296f('0xd')](_0x296f('0xe'),auth[_0x296f('0x8')](),controller['clone']);var upload=multer({'storage':multer[_0x296f('0xf')]({'destination':function(_0x1a2a02,_0x2aa644,_0x59c65d){_0x59c65d(null,path[_0x296f('0x10')](config[_0x296f('0x11')],_0x296f('0x12')));},'filename':function(_0x28dad3,_0x5710ac,_0x4ef1e3){_0x4ef1e3(null,util['format'](_0x296f('0x13'),Date[_0x296f('0x14')](),_0x5710ac[_0x296f('0x15')][_0x296f('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x296f('0x17')]('file'),controller['create']);router[_0x296f('0x18')](_0x296f('0x9'),auth[_0x296f('0x8')](),controller[_0x296f('0x19')]);router['delete']('/:id',auth[_0x296f('0x8')](),controller['destroy']);module[_0x296f('0x1a')]=router;