Yuki Takei 2 лет назад
Родитель
Сommit
e8b3416f5c
2 измененных файлов с 3 добавлено и 17 удалено
  1. 0 15
      apps/app/src/server/routes/attachment/api.js
  2. 3 2
      apps/app/src/server/routes/index.js

+ 0 - 15
apps/app/src/server/routes/attachment/api.js

@@ -260,21 +260,6 @@ export const routesFactory = (crowi) => {
     return responseForAttachment(req, res, attachment, true);
   };
 
-  /**
-   * @api {get} /attachments.get get attachments
-   * @apiName get
-   * @apiGroup Attachment
-   *
-   * @apiParam {String} id
-   */
-  api.get = async function(req, res) {
-    const id = req.params.id;
-
-    const attachment = await Attachment.findById(id);
-
-    return responseForAttachment(req, res, attachment);
-  };
-
   api.getBrandLogo = async function(req, res) {
     const brandLogoAttachment = await Attachment.findOne({ attachmentType: AttachmentType.BRAND_LOGO });
 

+ 3 - 2
apps/app/src/server/routes/index.js

@@ -158,8 +158,9 @@ module.exports = function(crowi, app) {
 
   app.get('/me'                                   , loginRequiredStrictly, next.delegateToNext);
   app.get('/me/*'                                 , loginRequiredStrictly, next.delegateToNext);
-  app.get('/attachment/:id([0-9a-z]{24})'         , certifySharedPageAttachmentMiddleware , loginRequired, attachment.validateGetRequest, attachmentApi.get);
-  app.get('/attachment/profile/:id([0-9a-z]{24})' , loginRequired, attachment.validateGetRequest, attachmentApi.get);
+
+  app.use('/attachment', attachment.getRouterFactory(crowi));
+
   app.get('/download/:id([0-9a-z]{24})'         , certifySharedPageAttachmentMiddleware, loginRequired, attachment.validateGetRequest, attachmentApi.download);
 
   app.get('/_search'                            , loginRequired, next.delegateToNext);