File tree Expand file tree Collapse file tree
app/Http/Controllers/Api/V2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -916,4 +916,32 @@ public function getLinkages($datasetVersionId)
916916
917917 return $ datasetLinkages ;
918918 }
919+
920+ // no Swagger
921+ public function updateIsCohortDiscovery (GetDataset $ request , int $ id )
922+ {
923+ try {
924+ $ input = $ request ->all ();
925+ $ isCohortDiscovery = isset ($ input ['is_cohort_discovery ' ]) ? $ input ['is_cohort_discovery ' ] : null ;
926+
927+ if (is_null ($ isCohortDiscovery )) {
928+ throw new Exception ('Payload is missing is_cohort_discovery ' );
929+ }
930+
931+ $ dataset = Dataset::where ('id ' , $ id )->first ();
932+
933+ if ($ dataset ->status !== Dataset::STATUS_ACTIVE ) {
934+ throw new Exception ('Dataset status is ' . strtoupper ($ dataset ->status ));
935+ }
936+
937+ $ dataset ->is_cohort_discovery = $ isCohortDiscovery ;
938+ $ dataset ->save ();
939+
940+ return response ()->json ([
941+ 'message ' => Config::get ('statuscodes.STATUS_OK.message ' ),
942+ ], Config::get ('statuscodes.STATUS_OK.code ' ));
943+ } catch (Exception $ e ) {
944+ throw new Exception ($ e ->getMessage ());
945+ }
946+ }
919947}
Original file line number Diff line number Diff line change 431431 'id ' , '[0-9]+ '
432432 ],
433433 ],
434+ [
435+ 'name ' => 'datasets ' ,
436+ 'method ' => 'put ' ,
437+ 'path ' => '/datasets/{id}/cohort-discovery ' ,
438+ 'methodController ' => 'DatasetController@updateIsCohortDiscovery ' ,
439+ 'namespaceController ' => 'App\Http\Controllers\Api\V2 ' ,
440+ 'middleware ' => [
441+ 'jwt.verify ' ,
442+ 'check.access:roles,hdruk.superadmin ' ,
443+ ],
444+ 'constraint ' => [
445+ 'id ' , '[0-9]+ '
446+ ],
447+ ],
434448
435449 // v2 teams/datasets
436450 [
You can’t perform that action at this time.
0 commit comments