94d3787d67700317640670871d7061638ea50005
[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 _0xb364=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','diskStorage','join','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','single','file','create','update','delete','exports'];(function(_0x4ba712,_0x2b019f){var _0x5dd347=function(_0x5326b2){while(--_0x5326b2){_0x4ba712['push'](_0x4ba712['shift']());}};_0x5dd347(++_0x2b019f);}(_0xb364,0x105));var _0x4b36=function(_0x56b1d3,_0x518d04){_0x56b1d3=_0x56b1d3-0x0;var _0x40863f=_0xb364[_0x56b1d3];return _0x40863f;};'use strict';var multer=require(_0x4b36('0x0'));var util=require(_0x4b36('0x1'));var path=require(_0x4b36('0x2'));var timeout=require(_0x4b36('0x3'));var express=require(_0x4b36('0x4'));var router=express[_0x4b36('0x5')]();var auth=require(_0x4b36('0x6'));var interaction=require(_0x4b36('0x7'));var config=require(_0x4b36('0x8'));var controller=require('./sound.controller');router[_0x4b36('0x9')]('/',auth['isAuthenticated'](),controller[_0x4b36('0xa')]);router['get'](_0x4b36('0xb'),auth[_0x4b36('0xc')](),controller[_0x4b36('0xd')]);router[_0x4b36('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x4b36('0xe')]({'destination':function(_0x375085,_0x5406e4,_0x316d74){_0x316d74(null,path[_0x4b36('0xf')](config['root'],_0x4b36('0x10')));},'filename':function(_0x2556be,_0x77b6ec,_0xcdb2de){_0x77b6ec[_0x4b36('0x11')]=_0x77b6ec['originalname'][_0x4b36('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xcdb2de(null,util['format'](_0x4b36('0x13'),path[_0x4b36('0x14')](_0x77b6ec[_0x4b36('0x11')],path['extname'](_0x77b6ec[_0x4b36('0x11')])),Date[_0x4b36('0x15')](),path[_0x4b36('0x16')](_0x77b6ec[_0x4b36('0x11')])));}})});router['post']('/',upload[_0x4b36('0x17')](_0x4b36('0x18')),controller[_0x4b36('0x19')]);router['put'](_0x4b36('0xb'),auth[_0x4b36('0xc')](),controller[_0x4b36('0x1a')]);router[_0x4b36('0x1b')](_0x4b36('0xb'),auth[_0x4b36('0xc')](),controller['delete']);module[_0x4b36('0x1c')]=router;