4c58391727db58c230d05867457286a0a6937091
[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 _0x8163=['download','diskStorage','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','single','file','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3570b2,_0x264fc8){var _0x3b5b53=function(_0x4a8b1e){while(--_0x4a8b1e){_0x3570b2['push'](_0x3570b2['shift']());}};_0x3b5b53(++_0x264fc8);}(_0x8163,0x9b));var _0x3816=function(_0x4ad8b1,_0x11380a){_0x4ad8b1=_0x4ad8b1-0x0;var _0x1a2ce3=_0x8163[_0x4ad8b1];return _0x1a2ce3;};'use strict';var multer=require(_0x3816('0x0'));var util=require(_0x3816('0x1'));var path=require('path');var timeout=require(_0x3816('0x2'));var express=require(_0x3816('0x3'));var router=express[_0x3816('0x4')]();var fs_extra=require(_0x3816('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3816('0x6'));var controller=require(_0x3816('0x7'));router['get']('/',auth[_0x3816('0x8')](),controller[_0x3816('0x9')]);router[_0x3816('0xa')](_0x3816('0xb'),auth[_0x3816('0x8')](),controller[_0x3816('0xc')]);router['get']('/:id/download',auth[_0x3816('0x8')](),controller[_0x3816('0xd')]);var upload=multer({'storage':multer[_0x3816('0xe')]({'destination':function(_0x23aaef,_0x10d754,_0x560865){_0x560865(null,path['join'](config[_0x3816('0xf')],_0x3816('0x10')));},'filename':function(_0x1f723e,_0x4fd3e4,_0x58ef9f){_0x4fd3e4[_0x3816('0x11')]=_0x4fd3e4[_0x3816('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58ef9f(null,util[_0x3816('0x12')](_0x3816('0x13'),path[_0x3816('0x14')](_0x4fd3e4['originalname'],path['extname'](_0x4fd3e4['originalname'])),Date['now'](),path[_0x3816('0x15')](_0x4fd3e4[_0x3816('0x11')])));}})});router['post']('/',upload[_0x3816('0x16')](_0x3816('0x17')),controller['create']);router[_0x3816('0x18')](_0x3816('0xb'),auth['isAuthenticated'](),controller[_0x3816('0x19')]);router[_0x3816('0x1a')]('/:id',auth[_0x3816('0x8')](),controller[_0x3816('0x1a')]);module[_0x3816('0x1b')]=router;