Built motion from commit (unavailable).|2.5.4
[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 _0x4c84=['join','root','format','now','replace','single','file','create','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage'];(function(_0x42fa22,_0xeb1cd5){var _0x4db0e6=function(_0x1a2f89){while(--_0x1a2f89){_0x42fa22['push'](_0x42fa22['shift']());}};_0x4db0e6(++_0xeb1cd5);}(_0x4c84,0x124));var _0x44c8=function(_0x5037db,_0x38b9af){_0x5037db=_0x5037db-0x0;var _0x39492f=_0x4c84[_0x5037db];return _0x39492f;};'use strict';var multer=require('multer');var util=require(_0x44c8('0x0'));var path=require(_0x44c8('0x1'));var timeout=require('connect-timeout');var express=require(_0x44c8('0x2'));var router=express[_0x44c8('0x3')]();var auth=require(_0x44c8('0x4'));var interaction=require(_0x44c8('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44c8('0x6')]);router['get'](_0x44c8('0x7'),auth[_0x44c8('0x8')](),controller[_0x44c8('0x9')]);router['get'](_0x44c8('0xa'),auth['isAuthenticated'](),controller[_0x44c8('0xb')]);router[_0x44c8('0xc')](_0x44c8('0xd'),auth[_0x44c8('0x8')](),controller[_0x44c8('0xe')]);var upload=multer({'storage':multer[_0x44c8('0xf')]({'destination':function(_0x3df77d,_0x30af9a,_0x53baca){_0x53baca(null,path[_0x44c8('0x10')](config[_0x44c8('0x11')],'server/files/attachments/'));},'filename':function(_0x2585df,_0x3d06f4,_0x5ecb19){_0x5ecb19(null,util[_0x44c8('0x12')]('%s-%s',Date[_0x44c8('0x13')](),_0x3d06f4['originalname'][_0x44c8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x44c8('0xc')]('/',upload[_0x44c8('0x15')](_0x44c8('0x16')),controller[_0x44c8('0x17')]);router[_0x44c8('0x18')](_0x44c8('0x7'),auth[_0x44c8('0x8')](),controller['update']);router[_0x44c8('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x44c8('0x1a')]);module[_0x44c8('0x1b')]=router;