95c62ee66567af62d9232bea036cf9021a934b76
[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 _0x7348=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','post','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','file','create','put','delete','destroy','exports','util'];(function(_0x5e46d7,_0xd36bbb){var _0xce1f6d=function(_0x3285be){while(--_0x3285be){_0x5e46d7['push'](_0x5e46d7['shift']());}};_0xce1f6d(++_0xd36bbb);}(_0x7348,0x16b));var _0x8734=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7348[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x8734('0x0'));var path=require(_0x8734('0x1'));var timeout=require('connect-timeout');var express=require(_0x8734('0x2'));var router=express[_0x8734('0x3')]();var auth=require(_0x8734('0x4'));var interaction=require(_0x8734('0x5'));var config=require(_0x8734('0x6'));var controller=require('./attachment.controller');router[_0x8734('0x7')]('/',auth['isAuthenticated'](),controller[_0x8734('0x8')]);router['get'](_0x8734('0x9'),auth[_0x8734('0xa')](),controller[_0x8734('0xb')]);router['get'](_0x8734('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x8734('0xd')]('/:id/clone',auth[_0x8734('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x8734('0xe')]({'destination':function(_0x398e71,_0x2ab38d,_0x326d26){_0x326d26(null,path['join'](config[_0x8734('0xf')],_0x8734('0x10')));},'filename':function(_0x32b0be,_0x9c3bf3,_0xca1e47){_0xca1e47(null,util[_0x8734('0x11')](_0x8734('0x12'),Date['now'](),_0x9c3bf3[_0x8734('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0x8734('0x14')),controller[_0x8734('0x15')]);router[_0x8734('0x16')](_0x8734('0x9'),auth[_0x8734('0xa')](),controller['update']);router[_0x8734('0x17')](_0x8734('0x9'),auth['isAuthenticated'](),controller[_0x8734('0x18')]);module[_0x8734('0x19')]=router;