Skip to content

Commit 595bb33

Browse files
committed
remove required count_only param
1 parent 18c1366 commit 595bb33

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

api-docs/openapi.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,9 +1201,6 @@
12011201
"parameters": [
12021202
{
12031203
"$ref": "#/components/parameters/cveState"
1204-
},
1205-
{
1206-
"$ref": "#/components/parameters/countOnly"
12071204
}
12081205
],
12091206
"responses": {

src/controller/cve.controller/cve.controller.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ async function getCve (req, res, next) {
3131
}
3232
}
3333

34+
// Called by GET /cve
35+
async function getFilteredCveCount (req, res, next) {
36+
try {
37+
req.ctx.query.count_only = '1'
38+
const result = await getFilteredCves(req,res,next)
39+
return result
40+
} catch (err) {
41+
next(err)
42+
}
43+
}
44+
3445
// Called by GET /cve
3546
async function getFilteredCves (req, res, next) {
3647
const CONSTANTS = getConstants()
@@ -916,6 +927,7 @@ module.exports = {
916927
CVE_GET_SINGLE: getCve,
917928
CVE_GET_FILTERED: getFilteredCves,
918929
CVE_GET_FILTERED_CURSOR: getFilteredCvesCursor,
930+
CVE_GET_FILTERED_COUNT: getFilteredCveCount,
919931
CVE_SUBMIT: submitCve,
920932
CVE_UPDATE_SINGLE: updateCve,
921933
CVE_SUBMIT_CNA: submitCna,

src/controller/cve.controller/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,11 @@ router.get('/cve_count',
326326
}
327327
328328
*/
329-
query().custom((query) => { return mw.validateQueryParameterNames(query, ['state', 'count_only']) }),
329+
query().custom((query) => { return mw.validateQueryParameterNames(query, ['state']) }),
330330
query(['state']).optional().isString().trim().customSanitizer(val => { return val.toUpperCase() }).isIn(CHOICES).withMessage(errorMsgs.CVE_FILTERED_STATES),
331-
query(['count_only']).optional().isBoolean({ loose: true }).withMessage(errorMsgs.COUNT_ONLY),
332331
parseError,
333332
parseGetParams,
334-
controller.CVE_GET_FILTERED)
333+
controller.CVE_GET_FILTERED_COUNT)
335334

336335

337336
router.get('/cve_cursor',

0 commit comments

Comments
 (0)