From f413ad5aa9a319dfa51feb76db5dfef36c952f78 Mon Sep 17 00:00:00 2001 From: "philip.cline" Date: Fri, 17 Feb 2023 15:27:03 -0500 Subject: [PATCH 1/2] feat(project endpoint): return otpServers --- .../datatools/manager/controllers/api/ProjectController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java b/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java index d237b753e..e32a80767 100644 --- a/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java +++ b/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java @@ -352,7 +352,7 @@ public static void register (String apiPrefix) { fullJson.addMixin(OtpServer.class, OtpServer.OtpServerWithoutEc2Instances.class); get(apiPrefix + "secure/project/:id", ProjectController::getProject, fullJson::write); - get(apiPrefix + "secure/project", ProjectController::getAllProjects, slimJson::write); + get(apiPrefix + "secure/project", ProjectController::getAllProjects, fullJson::write); post(apiPrefix + "secure/project", ProjectController::createProject, fullJson::write); put(apiPrefix + "secure/project/:id", ProjectController::updateProject, fullJson::write); delete(apiPrefix + "secure/project/:id", ProjectController::deleteProject, fullJson::write); From d4362dfa1ec8ec9a57d807a0348865339b992eae Mon Sep 17 00:00:00 2001 From: "philip.cline" Date: Fri, 17 Feb 2023 15:32:22 -0500 Subject: [PATCH 2/2] refactor(project endpoint): maintain slimJson --- .../manager/controllers/api/ProjectController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java b/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java index e32a80767..cf2f0e70a 100644 --- a/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java +++ b/src/main/java/com/conveyal/datatools/manager/controllers/api/ProjectController.java @@ -343,16 +343,17 @@ 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 slimJson = new JsonManager<>(Project.class, JsonViews.UserInterface.class); JsonManager 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, fullJson::write); + get(apiPrefix + "secure/project", ProjectController::getAllProjects, slimJson::write); post(apiPrefix + "secure/project", ProjectController::createProject, fullJson::write); put(apiPrefix + "secure/project/:id", ProjectController::updateProject, fullJson::write); delete(apiPrefix + "secure/project/:id", ProjectController::deleteProject, fullJson::write);