64731880c5111f0e687d357fcf6c1c95afcc596c
[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 _0xff48=['delete','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','put','update'];(function(_0x22ec46,_0x541733){var _0x52a26e=function(_0x1117ff){while(--_0x1117ff){_0x22ec46['push'](_0x22ec46['shift']());}};_0x52a26e(++_0x541733);}(_0xff48,0x7e));var _0x8ff4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff48[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ff4('0x0'));var timeout=require(_0x8ff4('0x1'));var express=require('express');var router=express[_0x8ff4('0x2')]();var auth=require(_0x8ff4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8ff4('0x4'));var controller=require(_0x8ff4('0x5'));router[_0x8ff4('0x6')]('/',auth[_0x8ff4('0x7')](),controller['index']);router[_0x8ff4('0x6')](_0x8ff4('0x8'),auth[_0x8ff4('0x7')](),controller['show']);router[_0x8ff4('0x6')](_0x8ff4('0x9'),auth[_0x8ff4('0x7')](),controller[_0x8ff4('0xa')]);var upload=multer({'storage':multer[_0x8ff4('0xb')]({'destination':function(_0x3da715,_0x328074,_0x1fc57e){_0x1fc57e(null,path[_0x8ff4('0xc')](config[_0x8ff4('0xd')],'server/files/sounds/original/'));},'filename':function(_0x3bf890,_0x374a54,_0x274a81){_0x374a54[_0x8ff4('0xe')]=_0x374a54[_0x8ff4('0xe')][_0x8ff4('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x274a81(null,util[_0x8ff4('0x10')](_0x8ff4('0x11'),path['basename'](_0x374a54[_0x8ff4('0xe')],path[_0x8ff4('0x12')](_0x374a54['originalname'])),Date[_0x8ff4('0x13')](),path[_0x8ff4('0x12')](_0x374a54[_0x8ff4('0xe')])));}})});router[_0x8ff4('0x14')]('/',upload['single'](_0x8ff4('0x15')),controller['create']);router[_0x8ff4('0x16')](_0x8ff4('0x8'),auth[_0x8ff4('0x7')](),controller[_0x8ff4('0x17')]);router[_0x8ff4('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8ff4('0x18')]);module['exports']=router;