Built motion from commit (unavailable).|2.5.25
[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 _0x13b6=['now','originalname','replace','single','file','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./attachment.controller','isAuthenticated','index','get','download','post','/:id/clone','clone','join','%s-%s'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x13b6,0x97));var _0x613b=function(_0x3804d4,_0x89cff3){_0x3804d4=_0x3804d4-0x0;var _0x3c3cca=_0x13b6[_0x3804d4];return _0x3c3cca;};'use strict';var multer=require(_0x613b('0x0'));var util=require('util');var path=require(_0x613b('0x1'));var timeout=require(_0x613b('0x2'));var express=require(_0x613b('0x3'));var router=express[_0x613b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x613b('0x5'));var config=require(_0x613b('0x6'));var controller=require(_0x613b('0x7'));router['get']('/',auth[_0x613b('0x8')](),controller[_0x613b('0x9')]);router[_0x613b('0xa')]('/:id',auth[_0x613b('0x8')](),controller['show']);router[_0x613b('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x613b('0xb')]);router[_0x613b('0xc')](_0x613b('0xd'),auth[_0x613b('0x8')](),controller[_0x613b('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51a45f,_0x2aaa78,_0x5b0b53){_0x5b0b53(null,path[_0x613b('0xf')](config['root'],'server/files/attachments/'));},'filename':function(_0x2f6cd6,_0x408b5f,_0x1567cd){_0x1567cd(null,util['format'](_0x613b('0x10'),Date[_0x613b('0x11')](),_0x408b5f[_0x613b('0x12')][_0x613b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x613b('0xc')]('/',upload[_0x613b('0x14')](_0x613b('0x15')),controller[_0x613b('0x16')]);router[_0x613b('0x17')](_0x613b('0x18'),auth['isAuthenticated'](),controller[_0x613b('0x19')]);router[_0x613b('0x1a')](_0x613b('0x18'),auth['isAuthenticated'](),controller['destroy']);module[_0x613b('0x1b')]=router;