Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / attachment / 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 _0x5eb1=['isAuthenticated','show','/:id/download','download','post','/:id/clone','clone','diskStorage','join','format','%s-%s','originalname','replace','single','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./attachment.controller','get','index'];(function(_0x4bcff5,_0x3f8591){var _0xc97579=function(_0x1b34be){while(--_0x1b34be){_0x4bcff5['push'](_0x4bcff5['shift']());}};_0xc97579(++_0x3f8591);}(_0x5eb1,0x7c));var _0x15eb=function(_0x1d90ca,_0x3bab16){_0x1d90ca=_0x1d90ca-0x0;var _0x28872b=_0x5eb1[_0x1d90ca];return _0x28872b;};'use strict';var multer=require('multer');var util=require(_0x15eb('0x0'));var path=require(_0x15eb('0x1'));var timeout=require(_0x15eb('0x2'));var express=require(_0x15eb('0x3'));var router=express[_0x15eb('0x4')]();var fs_extra=require(_0x15eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x15eb('0x6'));var config=require(_0x15eb('0x7'));var controller=require(_0x15eb('0x8'));router[_0x15eb('0x9')]('/',auth['isAuthenticated'](),controller[_0x15eb('0xa')]);router[_0x15eb('0x9')]('/:id',auth[_0x15eb('0xb')](),controller[_0x15eb('0xc')]);router[_0x15eb('0x9')](_0x15eb('0xd'),auth[_0x15eb('0xb')](),controller[_0x15eb('0xe')]);router[_0x15eb('0xf')](_0x15eb('0x10'),auth[_0x15eb('0xb')](),controller[_0x15eb('0x11')]);var upload=multer({'storage':multer[_0x15eb('0x12')]({'destination':function(_0x32a089,_0x4617f5,_0x56c25c){_0x56c25c(null,path[_0x15eb('0x13')](config['root'],'server/files/attachments/'));},'filename':function(_0x498a0c,_0xda1ddf,_0x330436){_0x330436(null,util[_0x15eb('0x14')](_0x15eb('0x15'),Date['now'](),_0xda1ddf[_0x15eb('0x16')][_0x15eb('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x15eb('0xf')]('/',upload[_0x15eb('0x18')]('file'),controller['create']);router['put']('/:id',auth[_0x15eb('0xb')](),controller['update']);router['delete'](_0x15eb('0x19'),auth['isAuthenticated'](),controller[_0x15eb('0x1a')]);module['exports']=router;