Skip to content

Commit

Permalink
#1074 updated the controllers to call the new schema items
Browse files Browse the repository at this point in the history
  • Loading branch information
david-rocca committed Jul 11, 2023
1 parent 74cb51f commit 7e0fe56
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/controller/cve.controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ router.post('/cve/:id',
required: true,
content: {
"application/json": {
schema:{ $ref: '../schemas/cve/create-full-cve-record-request.json' }
schema:{ $ref: '../schemas/cve/create-cve-record-secretariat-request.json' }
}
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ router.put('/cve/:id',
required: true,
content: {
"application/json": {
schema:{ $ref: '../schemas/cve/create-full-cve-record-request.json' }
schema:{ $ref: '../schemas/cve/create-cve-record-secretariat-request.json' }
}
}
}
Expand Down Expand Up @@ -360,7 +360,7 @@ router.post('/cve/:id/cna',
required: true,
content: {
"application/json": {
schema:{ $ref: '../schemas/cve/cve-record-minimum-request.json' }
schema:{ $ref: '../schemas/cve/create-cve-record-cna-request.json' }
}
}
}
Expand Down Expand Up @@ -446,7 +446,7 @@ router.put('/cve/:id/cna',
required: true,
content: {
"application/json": {
schema:{ $ref: '../schemas/cve/cve-record-minimum-request.json' }
schema:{ $ref: '../schemas/cve/create-cve-record-cna-request.json' }
}
}
}
Expand Down Expand Up @@ -706,7 +706,7 @@ router.put('/cve/:id/adp',
required: true,
content: {
"application/json": {
schema:{ $ref: '/schemas/cve/adp-minimum-request.json' }
schema:{ $ref: '/schemas/cve/create-adp-record-adp-request.json' }
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/controller/schemas.controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ router.get('/cve/update-cve-record-response.json', controller.getUpdateCveRecord
router.get('/cve/create-full-cve-record-request.json', controller.getFullCveRecordRequestSchema)
router.get('/cve/update-full-cve-record-response.json', controller.getFullUpdateCveRecordResponseSchema)
router.get('/cve/adp-minimum-request.json', controller.getAdpMinimumSchema)
router.get('/cve/create-cve-record-cna-request.json', controller.getCnaFullSchema)
router.get('/cve/create-adp-record-adp-request.json', controller.getAdpFullSchema)
router.get('/cve/create-cve-record-secretariat-request.json', controller.getCnaSecretariatFullSchema)

// Schemas relating to CVE IDs
router.get('/cve-id/create-cve-ids-response.json', controller.getCreateCveIdsResponseSchema)
Expand Down
23 changes: 22 additions & 1 deletion src/controller/schemas.controller/schemas.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ async function getAdpMinimumSchema (req, res) {
res.status(200)
}

async function getCnaFullSchema (req, res) {
const cnaFullSchema = require('../../../schemas/cve/create-cve-record-cna-request.json')
res.json(cnaFullSchema)
res.status(200)
}

async function getAdpFullSchema (req, res) {
const adpFullSchema = require('../../../schemas/cve/create-adp-record-adp-request.json')
res.json(adpFullSchema)
res.status(200)
}

async function getCnaSecretariatFullSchema (req, res) {
const cnaFullSchemaSecretariat = require('../../../schemas/cve/create-cve-record-secretariat-request.json')
res.json(cnaFullSchemaSecretariat)
res.status(200)
}

// Schemas relating to CVE IDs
async function getCreateCveIdsResponseSchema (req, res) {
const createCveIdsResponseSchema = require('../../../schemas/cve-id/create-cve-ids-response.json')
Expand Down Expand Up @@ -223,5 +241,8 @@ module.exports = {
getResetSecretResponseSchema: getResetSecretResponseSchema,
getUpdateUserResponseSchema: getUpdateUserResponseSchema,
getUpdateCVEIdResponseSchema: getUpdateCVEIdResponseSchema,
getAdpMinimumSchema: getAdpMinimumSchema
getAdpMinimumSchema: getAdpMinimumSchema,
getCnaFullSchema: getCnaFullSchema,
getAdpFullSchema: getAdpFullSchema,
getCnaSecretariatFullSchema: getCnaSecretariatFullSchema
}

0 comments on commit 7e0fe56

Please sign in to comment.