e1cbea46ce306b75926abf52b101e46d95382a1d
[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 _0x582b=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','post','single','create','/:id','update','delete','destroy','exports','util'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x582b,0x185));var _0xb582=function(_0x47a90a,_0x5c3276){_0x47a90a=_0x47a90a-0x0;var _0x1557b0=_0x582b[_0x47a90a];return _0x1557b0;};'use strict';var multer=require('multer');var util=require(_0xb582('0x0'));var path=require(_0xb582('0x1'));var timeout=require('connect-timeout');var express=require(_0xb582('0x2'));var router=express['Router']();var auth=require(_0xb582('0x3'));var interaction=require(_0xb582('0x4'));var config=require(_0xb582('0x5'));var controller=require(_0xb582('0x6'));router[_0xb582('0x7')]('/',auth[_0xb582('0x8')](),controller[_0xb582('0x9')]);router[_0xb582('0x7')]('/:id',auth[_0xb582('0x8')](),controller[_0xb582('0xa')]);router['get'](_0xb582('0xb'),auth['isAuthenticated'](),controller['download']);router['post'](_0xb582('0xc'),auth[_0xb582('0x8')](),controller[_0xb582('0xd')]);var upload=multer({'storage':multer[_0xb582('0xe')]({'destination':function(_0x914dec,_0x36b8b2,_0x373cc4){_0x373cc4(null,path[_0xb582('0xf')](config[_0xb582('0x10')],_0xb582('0x11')));},'filename':function(_0x6409d5,_0x361e01,_0x593a8b){_0x593a8b(null,util[_0xb582('0x12')]('%s-%s',Date[_0xb582('0x13')](),_0x361e01[_0xb582('0x14')][_0xb582('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb582('0x16')]('/',upload[_0xb582('0x17')]('file'),controller[_0xb582('0x18')]);router['put'](_0xb582('0x19'),auth[_0xb582('0x8')](),controller[_0xb582('0x1a')]);router[_0xb582('0x1b')](_0xb582('0x19'),auth[_0xb582('0x8')](),controller[_0xb582('0x1c')]);module[_0xb582('0x1d')]=router;