441bab21f9349569f78fe5436a4ccbf3d54e345f
[motion2.git] / server / api / sound / 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 _0x318b=['diskStorage','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','single','file','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','download'];(function(_0x5f3cab,_0x1b523d){var _0x2db243=function(_0x13ea97){while(--_0x13ea97){_0x5f3cab['push'](_0x5f3cab['shift']());}};_0x2db243(++_0x1b523d);}(_0x318b,0x130));var _0xb318=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x318b[_0x28089e];return _0x46a73c;};'use strict';var multer=require(_0xb318('0x0'));var util=require(_0xb318('0x1'));var path=require(_0xb318('0x2'));var timeout=require(_0xb318('0x3'));var express=require(_0xb318('0x4'));var router=express[_0xb318('0x5')]();var auth=require(_0xb318('0x6'));var interaction=require(_0xb318('0x7'));var config=require(_0xb318('0x8'));var controller=require(_0xb318('0x9'));router[_0xb318('0xa')]('/',auth['isAuthenticated'](),controller[_0xb318('0xb')]);router[_0xb318('0xa')](_0xb318('0xc'),auth[_0xb318('0xd')](),controller['show']);router[_0xb318('0xa')]('/:id/download',auth[_0xb318('0xd')](),controller[_0xb318('0xe')]);var upload=multer({'storage':multer[_0xb318('0xf')]({'destination':function(_0x4b3aa3,_0x373fd5,_0x389ded){_0x389ded(null,path['join'](config[_0xb318('0x10')],_0xb318('0x11')));},'filename':function(_0x80051,_0x321e2,_0x293b90){_0x321e2[_0xb318('0x12')]=_0x321e2[_0xb318('0x12')][_0xb318('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x293b90(null,util['format'](_0xb318('0x14'),path[_0xb318('0x15')](_0x321e2['originalname'],path['extname'](_0x321e2[_0xb318('0x12')])),Date[_0xb318('0x16')](),path[_0xb318('0x17')](_0x321e2[_0xb318('0x12')])));}})});router['post']('/',upload[_0xb318('0x18')](_0xb318('0x19')),controller['create']);router[_0xb318('0x1a')](_0xb318('0xc'),auth['isAuthenticated'](),controller[_0xb318('0x1b')]);router[_0xb318('0x1c')]('/:id',auth[_0xb318('0xd')](),controller[_0xb318('0x1c')]);module['exports']=router;