dc74c75b3efa4685de6981899a347307b9aa855c
[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 _0x1bc6=['../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','post','clone','diskStorage','server/files/attachments/','originalname','replace','single','file','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2c8f54,_0x3d5a57){var _0x5cd3e5=function(_0x4b0600){while(--_0x4b0600){_0x2c8f54['push'](_0x2c8f54['shift']());}};_0x5cd3e5(++_0x3d5a57);}(_0x1bc6,0x94));var _0x61bc=function(_0x5a61bf,_0x815b40){_0x5a61bf=_0x5a61bf-0x0;var _0x4974b6=_0x1bc6[_0x5a61bf];return _0x4974b6;};'use strict';var multer=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var path=require(_0x61bc('0x2'));var timeout=require(_0x61bc('0x3'));var express=require(_0x61bc('0x4'));var router=express[_0x61bc('0x5')]();var fs_extra=require(_0x61bc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x61bc('0x7'));var config=require(_0x61bc('0x8'));var controller=require(_0x61bc('0x9'));router[_0x61bc('0xa')]('/',auth[_0x61bc('0xb')](),controller[_0x61bc('0xc')]);router[_0x61bc('0xa')](_0x61bc('0xd'),auth[_0x61bc('0xb')](),controller['show']);router[_0x61bc('0xa')]('/:id/download',auth[_0x61bc('0xb')](),controller['download']);router[_0x61bc('0xe')]('/:id/clone',auth[_0x61bc('0xb')](),controller[_0x61bc('0xf')]);var upload=multer({'storage':multer[_0x61bc('0x10')]({'destination':function(_0x5f2543,_0x480314,_0x508f2f){_0x508f2f(null,path['join'](config['root'],_0x61bc('0x11')));},'filename':function(_0x4feac0,_0x3ecf9e,_0xd3759c){_0xd3759c(null,util['format']('%s-%s',Date['now'](),_0x3ecf9e[_0x61bc('0x12')][_0x61bc('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x61bc('0x14')](_0x61bc('0x15')),controller[_0x61bc('0x16')]);router[_0x61bc('0x17')](_0x61bc('0xd'),auth[_0x61bc('0xb')](),controller['update']);router[_0x61bc('0x18')](_0x61bc('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x61bc('0x19')]=router;