15cd572af0eb436da2d601d8e142ab08ec51ec5f
[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 _0x09e9=['post','single','file','create','put','update','delete','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','now'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x09e9,0x134));var _0x909e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x09e9[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x909e('0x0'));var util=require(_0x909e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x909e('0x2'));var router=express[_0x909e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x909e('0x4'));var config=require(_0x909e('0x5'));var controller=require('./sound.controller');router[_0x909e('0x6')]('/',auth['isAuthenticated'](),controller[_0x909e('0x7')]);router['get'](_0x909e('0x8'),auth[_0x909e('0x9')](),controller[_0x909e('0xa')]);router[_0x909e('0x6')](_0x909e('0xb'),auth[_0x909e('0x9')](),controller[_0x909e('0xc')]);var upload=multer({'storage':multer[_0x909e('0xd')]({'destination':function(_0x509fb7,_0x2fc4c2,_0x7885fa){_0x7885fa(null,path[_0x909e('0xe')](config[_0x909e('0xf')],'server/files/sounds/original/'));},'filename':function(_0x3963cd,_0x524e0e,_0x5d4761){_0x524e0e['originalname']=_0x524e0e[_0x909e('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5d4761(null,util[_0x909e('0x11')](_0x909e('0x12'),path[_0x909e('0x13')](_0x524e0e[_0x909e('0x10')],path[_0x909e('0x14')](_0x524e0e[_0x909e('0x10')])),Date[_0x909e('0x15')](),path['extname'](_0x524e0e[_0x909e('0x10')])));}})});router[_0x909e('0x16')]('/',upload[_0x909e('0x17')](_0x909e('0x18')),controller[_0x909e('0x19')]);router[_0x909e('0x1a')](_0x909e('0x8'),auth[_0x909e('0x9')](),controller[_0x909e('0x1b')]);router['delete']('/:id',auth[_0x909e('0x9')](),controller[_0x909e('0x1c')]);module[_0x909e('0x1d')]=router;