8813e5a703852ed9605ccc6b5ad10a6624b91f09
[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 _0x704b=['%s-%s%s','basename','extname','single','file','create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','index','get','/:id','isAuthenticated','download','join','root','originalname','replace','format'];(function(_0x58aee2,_0x364202){var _0x138675=function(_0xf6db9){while(--_0xf6db9){_0x58aee2['push'](_0x58aee2['shift']());}};_0x138675(++_0x364202);}(_0x704b,0x1ae));var _0xb704=function(_0x29db25,_0x457467){_0x29db25=_0x29db25-0x0;var _0x48b1a5=_0x704b[_0x29db25];return _0x48b1a5;};'use strict';var multer=require(_0xb704('0x0'));var util=require('util');var path=require(_0xb704('0x1'));var timeout=require(_0xb704('0x2'));var express=require(_0xb704('0x3'));var router=express['Router']();var fs_extra=require(_0xb704('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb704('0x5'));var config=require(_0xb704('0x6'));var controller=require(_0xb704('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb704('0x8')]);router[_0xb704('0x9')](_0xb704('0xa'),auth[_0xb704('0xb')](),controller['show']);router['get']('/:id/download',auth[_0xb704('0xb')](),controller[_0xb704('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e507f,_0x4b5432,_0x3a168b){_0x3a168b(null,path[_0xb704('0xd')](config[_0xb704('0xe')],'server/files/sounds/original/'));},'filename':function(_0x2138c9,_0x5c0f63,_0x399d43){_0x5c0f63[_0xb704('0xf')]=_0x5c0f63[_0xb704('0xf')][_0xb704('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x399d43(null,util[_0xb704('0x11')](_0xb704('0x12'),path[_0xb704('0x13')](_0x5c0f63['originalname'],path[_0xb704('0x14')](_0x5c0f63['originalname'])),Date['now'](),path[_0xb704('0x14')](_0x5c0f63[_0xb704('0xf')])));}})});router['post']('/',upload[_0xb704('0x15')](_0xb704('0x16')),controller[_0xb704('0x17')]);router[_0xb704('0x18')](_0xb704('0xa'),auth['isAuthenticated'](),controller[_0xb704('0x19')]);router[_0xb704('0x1a')](_0xb704('0xa'),auth['isAuthenticated'](),controller[_0xb704('0x1a')]);module[_0xb704('0x1b')]=router;