Built motion from commit 00bf23f6.|2.6.16
[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 _0x8d8c=['replace','format','%s-%s%s','basename','extname','now','post','single','file','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','diskStorage','root','originalname'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8d8c,0x1dd));var _0xc8d8=function(_0x18e014,_0x593ba7){_0x18e014=_0x18e014-0x0;var _0x858ce3=_0x8d8c[_0x18e014];return _0x858ce3;};'use strict';var multer=require(_0xc8d8('0x0'));var util=require(_0xc8d8('0x1'));var path=require('path');var timeout=require(_0xc8d8('0x2'));var express=require(_0xc8d8('0x3'));var router=express[_0xc8d8('0x4')]();var fs_extra=require(_0xc8d8('0x5'));var auth=require(_0xc8d8('0x6'));var interaction=require(_0xc8d8('0x7'));var config=require(_0xc8d8('0x8'));var controller=require('./sound.controller');router['get']('/',auth[_0xc8d8('0x9')](),controller['index']);router[_0xc8d8('0xa')](_0xc8d8('0xb'),auth[_0xc8d8('0x9')](),controller[_0xc8d8('0xc')]);router[_0xc8d8('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xc8d8('0xd')]({'destination':function(_0x1c66f9,_0x441e3d,_0x33ac8c){_0x33ac8c(null,path['join'](config[_0xc8d8('0xe')],'server/files/sounds/original/'));},'filename':function(_0x225694,_0x34a7fe,_0x41e01d){_0x34a7fe[_0xc8d8('0xf')]=_0x34a7fe['originalname'][_0xc8d8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41e01d(null,util[_0xc8d8('0x11')](_0xc8d8('0x12'),path[_0xc8d8('0x13')](_0x34a7fe[_0xc8d8('0xf')],path[_0xc8d8('0x14')](_0x34a7fe[_0xc8d8('0xf')])),Date[_0xc8d8('0x15')](),path['extname'](_0x34a7fe[_0xc8d8('0xf')])));}})});router[_0xc8d8('0x16')]('/',upload[_0xc8d8('0x17')](_0xc8d8('0x18')),controller[_0xc8d8('0x19')]);router['put'](_0xc8d8('0xb'),auth[_0xc8d8('0x9')](),controller[_0xc8d8('0x1a')]);router['delete'](_0xc8d8('0xb'),auth[_0xc8d8('0x9')](),controller[_0xc8d8('0x1b')]);module[_0xc8d8('0x1c')]=router;