1fc59e2796fed348b59a0a458125a833086ce7bd
[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 _0x80c7=['replace','post','single','file','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname'];(function(_0x3a89dc,_0x54bb1e){var _0x11c5c9=function(_0x21bd68){while(--_0x21bd68){_0x3a89dc['push'](_0x3a89dc['shift']());}};_0x11c5c9(++_0x54bb1e);}(_0x80c7,0x8d));var _0x780c=function(_0x4a06ce,_0x5350d3){_0x4a06ce=_0x4a06ce-0x0;var _0x451630=_0x80c7[_0x4a06ce];return _0x451630;};'use strict';var multer=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var path=require(_0x780c('0x2'));var timeout=require(_0x780c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x780c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x780c('0x5'));var controller=require(_0x780c('0x6'));router[_0x780c('0x7')]('/',auth[_0x780c('0x8')](),controller[_0x780c('0x9')]);router[_0x780c('0x7')](_0x780c('0xa'),auth[_0x780c('0x8')](),controller[_0x780c('0xb')]);router[_0x780c('0x7')](_0x780c('0xc'),auth['isAuthenticated'](),controller[_0x780c('0xd')]);var upload=multer({'storage':multer[_0x780c('0xe')]({'destination':function(_0x5c1ec3,_0x232f41,_0x43cdde){_0x43cdde(null,path[_0x780c('0xf')](config['root'],_0x780c('0x10')));},'filename':function(_0x353b4a,_0x46631e,_0x24fe4e){_0x24fe4e(null,util[_0x780c('0x11')](_0x780c('0x12'),Date[_0x780c('0x13')](),_0x46631e[_0x780c('0x14')][_0x780c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x780c('0x16')]('/',upload[_0x780c('0x17')](_0x780c('0x18')),controller['create']);router['put'](_0x780c('0xa'),auth[_0x780c('0x8')](),controller['update']);router['delete'](_0x780c('0xa'),auth[_0x780c('0x8')](),controller[_0x780c('0x19')]);module[_0x780c('0x1a')]=router;