9707fc1d200cde254af5e2f9c6762d118458e286
[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 _0xc2f2=['basename','now','extname','post','file','put','update','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2f2,0x134));var _0x2c2f=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xc2f2[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x2c2f('0x0'));var util=require(_0x2c2f('0x1'));var path=require(_0x2c2f('0x2'));var timeout=require(_0x2c2f('0x3'));var express=require('express');var router=express[_0x2c2f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c2f('0x5'));var config=require(_0x2c2f('0x6'));var controller=require(_0x2c2f('0x7'));router['get']('/',auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x9')]);router[_0x2c2f('0xa')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0xc')]);router['get'](_0x2c2f('0xd'),auth['isAuthenticated'](),controller[_0x2c2f('0xe')]);var upload=multer({'storage':multer[_0x2c2f('0xf')]({'destination':function(_0x284052,_0x2ac2cb,_0xb67485){_0xb67485(null,path['join'](config[_0x2c2f('0x10')],_0x2c2f('0x11')));},'filename':function(_0x3bbb1e,_0xd5fd1a,_0x2f730b){_0xd5fd1a[_0x2c2f('0x12')]=_0xd5fd1a[_0x2c2f('0x12')][_0x2c2f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f730b(null,util[_0x2c2f('0x14')](_0x2c2f('0x15'),path[_0x2c2f('0x16')](_0xd5fd1a['originalname'],path['extname'](_0xd5fd1a[_0x2c2f('0x12')])),Date[_0x2c2f('0x17')](),path[_0x2c2f('0x18')](_0xd5fd1a[_0x2c2f('0x12')])));}})});router[_0x2c2f('0x19')]('/',upload['single'](_0x2c2f('0x1a')),controller['create']);router[_0x2c2f('0x1b')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x1c')]);router['delete'](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x1d')]);module['exports']=router;