-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dataset_security_feature' into SIMSBIOHUB-397
- Loading branch information
Showing
25 changed files
with
959 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { RequestHandler } from 'express'; | ||
import { Operation } from 'express-openapi'; | ||
import { getAPIUserDBConnection } from '../../database/db'; | ||
import { defaultErrorResponses } from '../../openapi/schemas/http-responses'; | ||
import { SubmissionService } from '../../services/submission-service'; | ||
import { getLogger } from '../../utils/logger'; | ||
|
||
const defaultLog = getLogger('paths/submission'); | ||
|
||
export const GET: Operation = [getReviewedSubmissionsWithSecurity()]; | ||
|
||
GET.apiDoc = { | ||
description: 'Get a list of reviewed submissions', | ||
tags: ['submisssion', 'reviewed'], | ||
security: [], | ||
responses: { | ||
200: { | ||
description: 'List of reviewed submissions', | ||
content: { | ||
'application/json': { | ||
schema: { | ||
type: 'array', | ||
items: { | ||
type: 'object', | ||
properties: { | ||
submission_id: { | ||
type: 'integer', | ||
minimum: 1 | ||
}, | ||
uuid: { | ||
type: 'string', | ||
format: 'uuid' | ||
}, | ||
security_review_timestamp: { | ||
type: 'string', | ||
nullable: true | ||
}, | ||
source_system: { | ||
type: 'string' | ||
}, | ||
name: { | ||
type: 'string', | ||
maxLength: 200 | ||
}, | ||
description: { | ||
type: 'string', | ||
maxLength: 3000 | ||
}, | ||
create_date: { | ||
type: 'string' | ||
}, | ||
create_user: { | ||
type: 'integer', | ||
minimum: 1 | ||
}, | ||
update_date: { | ||
type: 'string', | ||
nullable: true | ||
}, | ||
update_user: { | ||
type: 'integer', | ||
minimum: 1, | ||
nullable: true | ||
}, | ||
revision_count: { | ||
type: 'integer', | ||
minimum: 0 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
...defaultErrorResponses | ||
} | ||
}; | ||
|
||
/** | ||
* Get all reviewed submissions (with security status). | ||
* | ||
* @returns {RequestHandler} | ||
*/ | ||
export function getReviewedSubmissionsWithSecurity(): RequestHandler { | ||
return async (_req, res) => { | ||
const connection = getAPIUserDBConnection(); | ||
|
||
try { | ||
await connection.open(); | ||
|
||
const service = new SubmissionService(connection); | ||
const response = await service.getReviewedSubmissionsWithSecurity(); | ||
|
||
await connection.commit(); | ||
|
||
return res.status(200).json(response); | ||
} catch (error) { | ||
await connection.rollback(); | ||
defaultLog.error({ label: 'getReviewedSubmissionsWithSecurity', message: 'error', error }); | ||
throw error; | ||
} finally { | ||
connection.release(); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.