e7e70bc99e12750a13c428b3cd0fc9eacf07b315
[motion-next.git] / server / api / attachment / index.js
1 const a32_0x5da0=['/:id','isAuthenticated','format','join','clone','diskStorage','../../config/environment','util','/:id/clone','/:id/download','show','create','delete','file','root','now','./attachment.controller','download','get','exports','update','post','path','Router','../../components/auth/service'];(function(_0x419281,_0x5da05a){const _0x44a1e1=function(_0x48a4c3){while(--_0x48a4c3){_0x419281['push'](_0x419281['shift']());}};_0x44a1e1(++_0x5da05a);}(a32_0x5da0,0x1ee));const a32_0x44a1=function(_0x419281,_0x5da05a){_0x419281=_0x419281-0x0;let _0x44a1e1=a32_0x5da0[_0x419281];return _0x44a1e1;};const _0x2b4849=a32_0x44a1;'use strict';const multer=require('multer'),util=require(_0x2b4849('0xd')),path=require(_0x2b4849('0x3')),express=require('express'),router=express[_0x2b4849('0x4')](),auth=require(_0x2b4849('0x5')),config=require(_0x2b4849('0xc')),controller=require(_0x2b4849('0x16'));router[_0x2b4849('0x18')]('/',auth['isAuthenticated'](),controller['index']),router['get'](_0x2b4849('0x6'),auth[_0x2b4849('0x7')](),controller[_0x2b4849('0x10')]),router[_0x2b4849('0x18')](_0x2b4849('0xf'),auth['isAuthenticated'](),controller[_0x2b4849('0x17')]),router[_0x2b4849('0x2')](_0x2b4849('0xe'),auth['isAuthenticated'](),controller[_0x2b4849('0xa')]);const upload=multer({'storage':multer[_0x2b4849('0xb')]({'destination':function(_0x48a4c3,_0x10c7be,_0x1ea3e4){const _0x513c26=_0x2b4849;_0x1ea3e4(null,path[_0x513c26('0x9')](config[_0x513c26('0x14')],'files/attachments/'));},'filename':function(_0x2b295b,_0x37e9c7,_0x551a72){const _0x1d942c=_0x2b4849;_0x551a72(null,util[_0x1d942c('0x8')]('%s-%s',Date[_0x1d942c('0x15')](),_0x37e9c7['originalname']['replace'](/[+@&/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2b4849('0x2')]('/',upload['single'](_0x2b4849('0x13')),controller[_0x2b4849('0x11')]),router['put'](_0x2b4849('0x6'),auth['isAuthenticated'](),controller[_0x2b4849('0x1')]),router[_0x2b4849('0x12')](_0x2b4849('0x6'),auth[_0x2b4849('0x7')](),controller['destroy']),module[_0x2b4849('0x0')]=router;