0a81e9a6874f2995de65e6ff6ff9205b2cb53df0
[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 _0x7f46=['now','post','single','file','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname'];(function(_0x238d71,_0x16cf3b){var _0x22491a=function(_0x3b3ce3){while(--_0x3b3ce3){_0x238d71['push'](_0x238d71['shift']());}};_0x22491a(++_0x16cf3b);}(_0x7f46,0xd3));var _0x67f4=function(_0x372915,_0x2dbd58){_0x372915=_0x372915-0x0;var _0x42ea51=_0x7f46[_0x372915];return _0x42ea51;};'use strict';var multer=require('multer');var util=require(_0x67f4('0x0'));var path=require(_0x67f4('0x1'));var timeout=require(_0x67f4('0x2'));var express=require(_0x67f4('0x3'));var router=express[_0x67f4('0x4')]();var auth=require(_0x67f4('0x5'));var interaction=require(_0x67f4('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x67f4('0x7')]('/',auth[_0x67f4('0x8')](),controller[_0x67f4('0x9')]);router[_0x67f4('0x7')](_0x67f4('0xa'),auth['isAuthenticated'](),controller[_0x67f4('0xb')]);router[_0x67f4('0x7')]('/:id/download',auth[_0x67f4('0x8')](),controller[_0x67f4('0xc')]);var upload=multer({'storage':multer[_0x67f4('0xd')]({'destination':function(_0x4eb775,_0x474029,_0x57a942){_0x57a942(null,path[_0x67f4('0xe')](config[_0x67f4('0xf')],'server/files/sounds/original/'));},'filename':function(_0x2dd405,_0x21a177,_0x6c39e7){_0x21a177[_0x67f4('0x10')]=_0x21a177[_0x67f4('0x10')][_0x67f4('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6c39e7(null,util['format'](_0x67f4('0x12'),path[_0x67f4('0x13')](_0x21a177[_0x67f4('0x10')],path[_0x67f4('0x14')](_0x21a177[_0x67f4('0x10')])),Date[_0x67f4('0x15')](),path[_0x67f4('0x14')](_0x21a177['originalname'])));}})});router[_0x67f4('0x16')]('/',upload[_0x67f4('0x17')](_0x67f4('0x18')),controller['create']);router[_0x67f4('0x19')]('/:id',auth[_0x67f4('0x8')](),controller[_0x67f4('0x1a')]);router[_0x67f4('0x1b')](_0x67f4('0xa'),auth[_0x67f4('0x8')](),controller[_0x67f4('0x1b')]);module[_0x67f4('0x1c')]=router;