Ver código fonte

Add types to get call request and response

arvid-e 5 meses atrás
pai
commit
5fcd855647

+ 5 - 1
apps/app/src/server/routes/apiv3/content-disposition-settings.ts

@@ -30,6 +30,10 @@ module.exports = (crowi) => {
     body('newAttachmentMimeTypes').isArray().withMessage('Attachment mime types must be an array.'),
   ];
 
+  interface AuthorizedRequest extends Request {
+    user?: IUserHasId;
+  }
+
   interface UpdateMimeTypesBody {
     newInlineMimeTypes: string[];
     newAttachmentMimeTypes: string[];
@@ -162,7 +166,7 @@ module.exports = (crowi) => {
  *                         type: string
  *
  */
-  router.get('/', loginRequiredStrictly, adminRequired, async(req, res) => {
+  router.get('/', loginRequiredStrictly, adminRequired, async(req: AuthorizedRequest, res: ApiV3Response) => {
     try {
       const inlineDispositionSettings = configManager.getConfig('attachments:contentDisposition:inlineMimeTypes');
       const attachmentDispositionSettings = configManager.getConfig('attachments:contentDisposition:attachmentMimeTypes');