diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-04 09:16:23 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-04 09:21:46 +0200 |
commit | 1333ab1f2d4ec495084c5368df25610683582ae3 (patch) | |
tree | 4d2b6f5b36d2acfacd5e5f6c3a9d35a9c7101658 /server/controllers/api/config.ts | |
parent | 1c627fd8d2e60d4d790353886006485343d70084 (diff) | |
download | PeerTube-1333ab1f2d4ec495084c5368df25610683582ae3.tar.gz PeerTube-1333ab1f2d4ec495084c5368df25610683582ae3.tar.zst PeerTube-1333ab1f2d4ec495084c5368df25610683582ae3.zip |
add operationId doc middleware to so API endpoints
Diffstat (limited to 'server/controllers/api/config.ts')
-rw-r--r-- | server/controllers/api/config.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 1f2a5f2da..9bd8c21c5 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -10,26 +10,32 @@ import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '.. | |||
10 | import { objectConverter } from '../../helpers/core-utils' | 10 | import { objectConverter } from '../../helpers/core-utils' |
11 | import { CONFIG, reloadConfig } from '../../initializers/config' | 11 | import { CONFIG, reloadConfig } from '../../initializers/config' |
12 | import { ClientHtml } from '../../lib/client-html' | 12 | import { ClientHtml } from '../../lib/client-html' |
13 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' | 13 | import { asyncMiddleware, authenticate, ensureUserHasRight, openapiOperationDoc } from '../../middlewares' |
14 | import { customConfigUpdateValidator } from '../../middlewares/validators/config' | 14 | import { customConfigUpdateValidator } from '../../middlewares/validators/config' |
15 | 15 | ||
16 | const configRouter = express.Router() | 16 | const configRouter = express.Router() |
17 | 17 | ||
18 | const auditLogger = auditLoggerFactory('config') | 18 | const auditLogger = auditLoggerFactory('config') |
19 | 19 | ||
20 | configRouter.get('/about', getAbout) | ||
21 | |||
22 | configRouter.get('/', | 20 | configRouter.get('/', |
21 | openapiOperationDoc({ operationId: 'getConfig' }), | ||
23 | asyncMiddleware(getConfig) | 22 | asyncMiddleware(getConfig) |
24 | ) | 23 | ) |
25 | 24 | ||
25 | configRouter.get('/about', | ||
26 | openapiOperationDoc({ operationId: 'getAbout' }), | ||
27 | getAbout | ||
28 | ) | ||
29 | |||
26 | configRouter.get('/custom', | 30 | configRouter.get('/custom', |
31 | openapiOperationDoc({ operationId: 'getCustomConfig' }), | ||
27 | authenticate, | 32 | authenticate, |
28 | ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), | 33 | ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), |
29 | getCustomConfig | 34 | getCustomConfig |
30 | ) | 35 | ) |
31 | 36 | ||
32 | configRouter.put('/custom', | 37 | configRouter.put('/custom', |
38 | openapiOperationDoc({ operationId: 'putCustomConfig' }), | ||
33 | authenticate, | 39 | authenticate, |
34 | ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), | 40 | ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), |
35 | customConfigUpdateValidator, | 41 | customConfigUpdateValidator, |
@@ -37,6 +43,7 @@ configRouter.put('/custom', | |||
37 | ) | 43 | ) |
38 | 44 | ||
39 | configRouter.delete('/custom', | 45 | configRouter.delete('/custom', |
46 | openapiOperationDoc({ operationId: 'delCustomConfig' }), | ||
40 | authenticate, | 47 | authenticate, |
41 | ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), | 48 | ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), |
42 | asyncMiddleware(deleteCustomConfig) | 49 | asyncMiddleware(deleteCustomConfig) |