Skip to content

Commit eefe787

Browse files
authored
Merge pull request #246 from OpenPathfinder/ulises/v1-compliance-check
2 parents 9c7cd61 + 69ca481 commit eefe787

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

__tests__/httpServer/apiV1.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ describe('HTTP Server API V1', () => {
392392
test.todo('should return 500 for internal server error')
393393
})
394394

395-
describe('GET /api/v1/check', () => {
395+
describe('GET /api/v1/compliance-check', () => {
396396
test('should return 200 and a list of checks', async () => {
397-
const response = await app.get('/api/v1/check')
397+
const response = await app.get('/api/v1/compliance-check')
398398
const storedChecks = await getAllChecks()
399399

400400
expect(response.status).toBe(200)
@@ -405,9 +405,9 @@ describe('HTTP Server API V1', () => {
405405
test.todo('should return 500 for internal server error')
406406
})
407407

408-
describe('GET /api/v1/check/:checkId', () => {
408+
describe('GET /api/v1/compliance-check/:checkId', () => {
409409
test('should return 200 and a check by ID', async () => {
410-
const response = await app.get('/api/v1/check/1')
410+
const response = await app.get('/api/v1/compliance-check/1')
411411
const storedCheck = await getCheckById(1)
412412

413413
expect(response.status).toBe(200)
@@ -416,15 +416,15 @@ describe('HTTP Server API V1', () => {
416416
})
417417

418418
test('should return 400 for invalid check ID', async () => {
419-
const response = await app.get('/api/v1/check/invalid')
419+
const response = await app.get('/api/v1/compliance-check/invalid')
420420

421421
expect(response.status).toBe(400)
422422
expect(response.body).toHaveProperty('errors')
423423
expect(response.body.errors[0]).toHaveProperty('message', 'must be integer')
424424
})
425425

426426
test('should return 404 for check not found', async () => {
427-
const response = await app.get('/api/v1/check/9999999')
427+
const response = await app.get('/api/v1/compliance-check/9999999')
428428

429429
expect(response.status).toBe(404)
430430
expect(response.body).toHaveProperty('errors')

src/httpServer/routers/apiV1.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function createApiRouter (knex, express) {
121121
}
122122
})
123123

124-
router.get('/check/:checkId', async (req, res) => {
124+
router.get('/compliance-check/:checkId', async (req, res) => {
125125
try {
126126
// Params validation done in swagger
127127
const checkId = parseInt(req.params.checkId, 10)
@@ -136,7 +136,7 @@ function createApiRouter (knex, express) {
136136
}
137137
})
138138

139-
router.get('/check', async (req, res) => {
139+
router.get('/compliance-check', async (req, res) => {
140140
try {
141141
const checks = await getAllChecks()
142142
res.json(checks)

src/httpServer/swagger/api-v1.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ paths:
211211
application/json:
212212
schema:
213213
$ref: '#/components/schemas/ErrorResponse'
214-
/api/v1/check/{checkId}:
214+
/api/v1/compliance-check/{checkId}:
215215
get:
216-
summary: Get a check by ID
217-
description: Returns a check by ID
218-
operationId: getCheckById
216+
summary: Get a compliance check by ID
217+
description: Returns a compliance check by ID
218+
operationId: getComplianceCheckById
219219
tags:
220-
- Checks
220+
- Compliance Checks
221221
parameters:
222222
- name: checkId
223223
in: path
@@ -229,19 +229,19 @@ paths:
229229
example: 53
230230
responses:
231231
'200':
232-
description: A check
232+
description: A compliance check
233233
content:
234234
application/json:
235235
schema:
236-
$ref: '#/components/schemas/Check'
236+
$ref: '#/components/schemas/ComplianceCheck'
237237
'400':
238238
description: Bad request, invalid input data
239239
content:
240240
application/json:
241241
schema:
242242
$ref: '#/components/schemas/ErrorResponse'
243243
'404':
244-
description: Check not found
244+
description: Compliance check not found
245245
content:
246246
application/json:
247247
schema:
@@ -252,22 +252,22 @@ paths:
252252
application/json:
253253
schema:
254254
$ref: '#/components/schemas/ErrorResponse'
255-
/api/v1/check:
255+
/api/v1/compliance-check:
256256
get:
257-
summary: List all checks
258-
description: Returns a list of all checks
259-
operationId: listChecks
257+
summary: List all compliance checks
258+
description: Returns a list of all compliance checks
259+
operationId: listComplianceChecks
260260
tags:
261-
- Checks
261+
- Compliance Checks
262262
responses:
263263
'200':
264-
description: A list of checks
264+
description: A list of compliance checks
265265
content:
266266
application/json:
267267
schema:
268268
type: array
269269
items:
270-
$ref: '#/components/schemas/Check'
270+
$ref: '#/components/schemas/ComplianceCheck'
271271
'500':
272272
description: Internal server error
273273
content:
@@ -328,7 +328,7 @@ paths:
328328

329329
components:
330330
schemas:
331-
Check:
331+
ComplianceCheck:
332332
type: object
333333
additionalProperties: false
334334
properties:

0 commit comments

Comments
 (0)