Built motion from commit (unavailable).|2.5.31
[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 _0x7fce=['multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','clone','diskStorage','join','now','originalname','replace','single','create','update','delete'];(function(_0x1c12fa,_0x2cfc4f){var _0x2f4e4b=function(_0x4ccc20){while(--_0x4ccc20){_0x1c12fa['push'](_0x1c12fa['shift']());}};_0x2f4e4b(++_0x2cfc4f);}(_0x7fce,0xdc));var _0xe7fc=function(_0x118389,_0xf610c1){_0x118389=_0x118389-0x0;var _0x412b5f=_0x7fce[_0x118389];return _0x412b5f;};'use strict';var multer=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var path=require(_0xe7fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7fc('0x3'));var router=express['Router']();var fs_extra=require(_0xe7fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));var controller=require('./attachment.controller');router['get']('/',auth[_0xe7fc('0x7')](),controller['index']);router[_0xe7fc('0x8')](_0xe7fc('0x9'),auth[_0xe7fc('0x7')](),controller[_0xe7fc('0xa')]);router[_0xe7fc('0x8')]('/:id/download',auth[_0xe7fc('0x7')](),controller['download']);router[_0xe7fc('0xb')]('/:id/clone',auth[_0xe7fc('0x7')](),controller[_0xe7fc('0xc')]);var upload=multer({'storage':multer[_0xe7fc('0xd')]({'destination':function(_0x31c05f,_0x53a26c,_0x278e9a){_0x278e9a(null,path[_0xe7fc('0xe')](config['root'],'server/files/attachments/'));},'filename':function(_0x243600,_0x59da2e,_0x38512a){_0x38512a(null,util['format']('%s-%s',Date[_0xe7fc('0xf')](),_0x59da2e[_0xe7fc('0x10')][_0xe7fc('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe7fc('0xb')]('/',upload[_0xe7fc('0x12')]('file'),controller[_0xe7fc('0x13')]);router['put']('/:id',auth[_0xe7fc('0x7')](),controller[_0xe7fc('0x14')]);router[_0xe7fc('0x15')](_0xe7fc('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router;