f3ce27be6d835c4aded94c0cfaa1d4f79fbc6e16
[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 _0x9d5b=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','show','/:id/download','download','post','clone','join','root','server/files/attachments/','format','%s-%s','originalname','replace','single','file','create','/:id','update'];(function(_0x51ea94,_0x2ac049){var _0x43c72b=function(_0x5bceb8){while(--_0x5bceb8){_0x51ea94['push'](_0x51ea94['shift']());}};_0x43c72b(++_0x2ac049);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x590ff1,_0x33974a){_0x590ff1=_0x590ff1-0x0;var _0x311834=_0x9d5b[_0x590ff1];return _0x311834;};'use strict';var multer=require('multer');var util=require(_0xb9d5('0x0'));var path=require(_0xb9d5('0x1'));var timeout=require(_0xb9d5('0x2'));var express=require(_0xb9d5('0x3'));var router=express[_0xb9d5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9d5('0x5'));var config=require('../../config/environment');var controller=require(_0xb9d5('0x6'));router[_0xb9d5('0x7')]('/',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x9')]);router[_0xb9d5('0x7')]('/:id',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xa')]);router['get'](_0xb9d5('0xb'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xc')]);router[_0xb9d5('0xd')]('/:id/clone',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x35d69f,_0x34b0a7,_0x41dd9a){_0x41dd9a(null,path[_0xb9d5('0xf')](config[_0xb9d5('0x10')],_0xb9d5('0x11')));},'filename':function(_0x3e237e,_0x447cb7,_0x1a4c7f){_0x1a4c7f(null,util[_0xb9d5('0x12')](_0xb9d5('0x13'),Date['now'](),_0x447cb7[_0xb9d5('0x14')][_0xb9d5('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xb9d5('0x16')](_0xb9d5('0x17')),controller[_0xb9d5('0x18')]);router['put'](_0xb9d5('0x19'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x1a')]);router[_0xb9d5('0x1b')](_0xb9d5('0x19'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x1c')]);module[_0xb9d5('0x1d')]=router;