Skip to content
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