-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[risk=low][RW-12566] Add a Get Featured Workspaces (from DB) endpoint (…
…#8650) * rm unused WorkspaceServiceFakeImpl
- Loading branch information
1 parent
6cfc19b
commit debc763
Showing
8 changed files
with
140 additions
and
96 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
api/src/main/java/org/pmiops/workbench/api/FeaturedWorkspaceController.java
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,40 @@ | ||
package org.pmiops.workbench.api; | ||
|
||
import jakarta.inject.Provider; | ||
import org.pmiops.workbench.config.WorkbenchConfig; | ||
import org.pmiops.workbench.exceptions.NotImplementedException; | ||
import org.pmiops.workbench.model.WorkspaceResponseListResponse; | ||
import org.pmiops.workbench.workspaces.WorkspaceService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class FeaturedWorkspaceController implements FeaturedWorkspaceApiDelegate { | ||
|
||
private final Provider<WorkbenchConfig> workbenchConfigProvider; | ||
private final WorkspaceService workspaceService; | ||
|
||
@Autowired | ||
FeaturedWorkspaceController( | ||
Provider<WorkbenchConfig> workbenchConfigProvider, WorkspaceService workspaceService) { | ||
this.workbenchConfigProvider = workbenchConfigProvider; | ||
this.workspaceService = workspaceService; | ||
} | ||
|
||
/** | ||
* Get all Featured workspaces, using the Featured Workspace DB table as the source. | ||
* | ||
* @return List of all Featured workspaces | ||
*/ | ||
@Override | ||
public ResponseEntity<WorkspaceResponseListResponse> getFeaturedWorkspaces() { | ||
if (workbenchConfigProvider.get().featureFlags.enablePublishedWorkspacesViaDb) { | ||
return ResponseEntity.ok( | ||
new WorkspaceResponseListResponse().items(workspaceService.getFeaturedWorkspaces())); | ||
} else { | ||
throw new NotImplementedException( | ||
"Not implemented in this environment: combine the results of getFeaturedWorkspacesConfig() and getPublishedWorkspaces() to generate the list of featured workspaces."); | ||
} | ||
} | ||
} |
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 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
90 changes: 0 additions & 90 deletions
90
api/src/main/java/org/pmiops/workbench/workspaces/WorkspaceServiceFakeImpl.java
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
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