78a0519b87fd022dc695cb724898c6f519e4f311
[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 _0x3b47=['single','create','put','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','/:id/download','isAuthenticated','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','post'];(function(_0x27fcc1,_0x3537a1){var _0x5b8476=function(_0x551bf2){while(--_0x551bf2){_0x27fcc1['push'](_0x27fcc1['shift']());}};_0x5b8476(++_0x3537a1);}(_0x3b47,0x1d4));var _0x73b4=function(_0x9568cd,_0x1640fe){_0x9568cd=_0x9568cd-0x0;var _0x13c849=_0x3b47[_0x9568cd];return _0x13c849;};'use strict';var multer=require(_0x73b4('0x0'));var util=require(_0x73b4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73b4('0x2'));var router=express[_0x73b4('0x3')]();var fs_extra=require(_0x73b4('0x4'));var auth=require(_0x73b4('0x5'));var interaction=require(_0x73b4('0x6'));var config=require(_0x73b4('0x7'));var controller=require(_0x73b4('0x8'));router[_0x73b4('0x9')]('/',auth['isAuthenticated'](),controller[_0x73b4('0xa')]);router[_0x73b4('0x9')](_0x73b4('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x73b4('0xc'),auth[_0x73b4('0xd')](),controller[_0x73b4('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32abf1,_0x16d8f2,_0x26b233){_0x26b233(null,path[_0x73b4('0xf')](config[_0x73b4('0x10')],_0x73b4('0x11')));},'filename':function(_0x20cb6c,_0x53624d,_0x456c1a){_0x53624d[_0x73b4('0x12')]=_0x53624d['originalname'][_0x73b4('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x456c1a(null,util['format'](_0x73b4('0x14'),path[_0x73b4('0x15')](_0x53624d[_0x73b4('0x12')],path['extname'](_0x53624d[_0x73b4('0x12')])),Date[_0x73b4('0x16')](),path[_0x73b4('0x17')](_0x53624d[_0x73b4('0x12')])));}})});router[_0x73b4('0x18')]('/',upload[_0x73b4('0x19')]('file'),controller[_0x73b4('0x1a')]);router[_0x73b4('0x1b')](_0x73b4('0xb'),auth[_0x73b4('0xd')](),controller['update']);router[_0x73b4('0x1c')](_0x73b4('0xb'),auth[_0x73b4('0xd')](),controller['delete']);module['exports']=router;