Просмотр исходного кода

Merge pull request #9795 from goofmint/fix/doc-v3-user-ui-settings

support(jsdoc): Add swagger document to user-ui-settings.ts
Yuki Takei 1 год назад
Родитель
Сommit
897b076ed1

+ 1 - 1
apps/app/bin/swagger-jsdoc/definition-apiv3.js

@@ -47,7 +47,7 @@ module.exports = {
         'Revisions',
         'ShareLinks',
         'Users',
-        '',
+        'UserUISettings',
         '',
       ],
     },

+ 45 - 0
apps/app/src/server/routes/apiv3/user-ui-settings.ts

@@ -21,6 +21,51 @@ module.exports = () => {
     body('settings.preferCollapsedModeByUser').optional().isBoolean(),
   ];
 
+  /**
+   * @swagger
+   *
+   * /user-ui-settings:
+   *   put:
+   *     tags: [UserUISettings]
+   *     security:
+   *       - cookieAuth: []
+   *     summary: /user-ui-settings
+   *     description: Update the user's UI settings
+   *     requestBody:
+   *       required: true
+   *       content:
+   *         application/json:
+   *           schema:
+   *             type: object
+   *             properties:
+   *               settings:
+   *                 type: object
+   *                 properties:
+   *                   currentSidebarContents:
+   *                     type: string
+   *                   currentProductNavWidth:
+   *                     type: number
+   *                   preferCollapsedModeByUser:
+   *                     type: boolean
+   *     responses:
+   *       200:
+   *         description: The user's UI settings
+   *         content:
+   *           application/json:
+   *             schema:
+   *               type: object
+   *               properties:
+   *                 _id:
+   *                   type: string
+   *                 user:
+   *                   type: string
+   *                 __v:
+   *                   type: number
+   *                 currentSidebarContents:
+   *                   type: string
+   *                 preferCollapsedModeByUser:
+   *                   type: boolean
+   */
   // eslint-disable-next-line @typescript-eslint/no-explicit-any
   router.put('/', validatorForPut, apiV3FormValidator, async(req: any, res: any) => {
     const { user } = req;