Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/httpServer/routers/apiV1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { generateStaticReports } = require('../../reports')
const { logger } = require('../../utils')
const { initializeStore } = require('../../store')

function createApiRouter (knex, express) {
const router = express.Router()
Expand All @@ -8,6 +9,17 @@ function createApiRouter (knex, express) {
res.json({ status: 'ok', timestamp: new Date().toISOString() })
})

router.get('/checks', async (req, res) => {
try {
const { getAllComplianceChecks } = initializeStore(knex)
const checks = await getAllComplianceChecks()
res.json(checks)
} catch (error) {
logger.error(error)
res.status(500).json({ status: 'Failed to fetch compliance checks' })
}
})

router.post('/generate-reports', async (req, res) => {
const startTs = new Date().toISOString()
try {
Expand All @@ -26,6 +38,7 @@ function createApiRouter (knex, express) {
})
}
})

return router
}

Expand Down
65 changes: 65 additions & 0 deletions src/httpServer/swagger/api-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,71 @@ paths:
required:
- status
- timestamp

/api/v1/checks:
get:
summary: List all available checks
description: Returns the all available checks
operationId: getChecks
tags:
- System
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
type: object
additionalProperties: false
properties:
id:
type: number
example: 9
title:
type: string
example: Check title
description:
type: string
example: Check description
default_section_number:
type: string
example: "1"
default_section_name:
type: string
example: Check section name
code_name:
type: string
example: check_code_name
default_priority_group:
type: string
example: R6
is_c_scrm:
type: boolean
example: true
implementation_status:
type: string
example: completed
implementation_type:
nullable: true
type: string
example: manual
implementation_details_reference:
type: string
nullable: true
example: https://example.com/implementation-details
details_url:
type: string
example: https://openpathfinder.com/docs/checks/annualDependencyRefresh
created_at:
type: string
format: date-time
example: '2025-05-03T07:20:16.000Z'
updated_at:
type: string
format: date-time
example: '2025-05-03T07:20:16.000Z'

/api/v1/generate-reports:
post:
Expand Down
Loading