Built motion from commit (unavailable).|2.5.21
[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 _0x3c91=['util','path','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','show','/:id/download','download','clone','join','root','server/files/attachments/','format','single','file','put','/:id','update','delete','multer'];(function(_0x1c30bf,_0x247c31){var _0x255b5e=function(_0x70c22b){while(--_0x70c22b){_0x1c30bf['push'](_0x1c30bf['shift']());}};_0x255b5e(++_0x247c31);}(_0x3c91,0x1af));var _0x13c9=function(_0x2d081b,_0x480a45){_0x2d081b=_0x2d081b-0x0;var _0x90658a=_0x3c91[_0x2d081b];return _0x90658a;};'use strict';var multer=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var path=require(_0x13c9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13c9('0x3')]();var auth=require(_0x13c9('0x4'));var interaction=require(_0x13c9('0x5'));var config=require('../../config/environment');var controller=require(_0x13c9('0x6'));router[_0x13c9('0x7')]('/',auth[_0x13c9('0x8')](),controller[_0x13c9('0x9')]);router[_0x13c9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x13c9('0xa')]);router[_0x13c9('0x7')](_0x13c9('0xb'),auth[_0x13c9('0x8')](),controller[_0x13c9('0xc')]);router['post']('/:id/clone',auth[_0x13c9('0x8')](),controller[_0x13c9('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x59ed70,_0x13f278,_0xc3afa8){_0xc3afa8(null,path[_0x13c9('0xe')](config[_0x13c9('0xf')],_0x13c9('0x10')));},'filename':function(_0x25eac0,_0x1f63b8,_0x4a5f84){_0x4a5f84(null,util[_0x13c9('0x11')]('%s-%s',Date['now'](),_0x1f63b8['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x13c9('0x12')](_0x13c9('0x13')),controller['create']);router[_0x13c9('0x14')](_0x13c9('0x15'),auth[_0x13c9('0x8')](),controller[_0x13c9('0x16')]);router[_0x13c9('0x17')](_0x13c9('0x15'),auth[_0x13c9('0x8')](),controller['destroy']);module['exports']=router;