@@ -11,6 +11,7 @@ import { ProjectGroupUserQueryParams } from "../model/params/project-group-user-
1111import { Utility } from "../utility/utility" ;
1212import queryValidationMiddleware from "../middleware/query-params-validation-middleware" ;
1313import { listRequestValidation } from "../middleware/list-request-validation-middleware" ;
14+ import { DatasetViewerDto , FeedbackTurnaroundTime } from "../model/dto/dataset-viewer-dto" ;
1415
1516class ProjectGroupController implements IController {
1617 public path = '' ;
@@ -26,6 +27,28 @@ class ProjectGroupController implements IController {
2627 this . router . get ( `${ this . path } /api/v1/project-group` , listRequestValidation , authorizationMiddleware ( [ ] ) , queryValidationMiddleware ( ProjectGroupQueryParams ) , this . getProjectGroup ) ;
2728 this . router . get ( `${ this . path } /api/v1/project-group/:projectGroupId/users` , authorizationMiddleware ( [ Role . TDEI_ADMIN , Role . POC ] , true ) , this . getProjectGroupUsers ) ;
2829 this . router . put ( `${ this . path } /api/v1/project-group/:projectGroupId/active/:status` , authorizationMiddleware ( [ Role . TDEI_ADMIN ] ) , this . deleteProjectGroup ) ;
30+ this . router . post ( `${ this . path } /api/v1/project-group/:projectGroupId/dataset-viewer` , authorizationMiddleware ( [ Role . TDEI_ADMIN , Role . POC ] , true ) , this . putDatasetViewer ) ;
31+ }
32+
33+ /**
34+ * Gets the dataset viewer configuration for a project group
35+ * @param req - The request object
36+ * @param res - The response object
37+ * @param next - The next middleware function
38+ */
39+ async putDatasetViewer ( req : Request , res : express . Response , next : NextFunction ) {
40+ try {
41+ let projectGroupId = req . params . projectGroupId ;
42+ let datasetViewerConfig = DatasetViewerDto . from ( req . body ) ;
43+ datasetViewerConfig . feedback_turnaround_time = FeedbackTurnaroundTime . from ( datasetViewerConfig . feedback_turnaround_time ) ;
44+
45+ await datasetViewerConfig . validateRequestInput ( ) ;
46+ const result = await projectGroupService . updateDatasetViewerConfig ( projectGroupId , datasetViewerConfig ) ;
47+ Ok ( res , result ) ;
48+ } catch ( error ) {
49+ let errorMessage = "Error updating the dataset viewer config." ;
50+ Utility . handleError ( res , next , error , errorMessage ) ;
51+ }
2952 }
3053
3154 public deleteProjectGroup = async ( request : Request , response : express . Response , next : NextFunction ) => {
0 commit comments