Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return otpServers with /project endpoint to allow speedup #514

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,14 @@ private static Project thirdPartySync(Request req, Response res) {
*/
public static void register (String apiPrefix) {
// Construct JSON managers which help serialize the response. Slim JSON is the generic JSON view. Full JSON
// contains additional fields (at the moment just #otpServers) and should only be used when the controller
// contains additional fields (at the moment just #OtpServerWithoutEc2Instances) and should only be used when the controller
// returns a single project (slimJson is better suited for a collection). If fullJson is attempted for use
// with a collection, massive performance issues will ensure (mainly due to multiple calls to AWS EC2).
// with a collection, massive performance issues will ensue (mainly due to multiple calls to AWS EC2).
JsonManager<Project> slimJson = new JsonManager<>(Project.class, JsonViews.UserInterface.class);
JsonManager<Project> fullJson = new JsonManager<>(Project.class, JsonViews.UserInterface.class);
fullJson.addMixin(Project.class, Project.ProjectWithOtpServers.class);
fullJson.addMixin(OtpServer.class, OtpServer.OtpServerWithoutEc2Instances.class);
slimJson.addMixin(Project.class, Project.ProjectWithOtpServers.class);

get(apiPrefix + "secure/project/:id", ProjectController::getProject, fullJson::write);
get(apiPrefix + "secure/project", ProjectController::getAllProjects, slimJson::write);
Expand Down