diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/LogoutSuccessHandlerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/LogoutSuccessHandlerCE.java index 201e5fea333c..e18d4f34cc0b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/LogoutSuccessHandlerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/LogoutSuccessHandlerCE.java @@ -45,7 +45,7 @@ public Mono onLogoutSuccess(WebFilterExchange webFilterExchange, Authentic ServerHttpResponse response = exchange.getResponse(); response.setStatusCode(HttpStatus.OK); response.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); - ResponseDTO responseBody = new ResponseDTO<>(HttpStatus.OK.value(), true, null); + ResponseDTO responseBody = new ResponseDTO<>(HttpStatus.OK, true); String responseStr; try { responseStr = objectMapper.writeValueAsString(responseBody); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ConsolidatedAPIController.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ConsolidatedAPIController.java index 4dc87ba917f2..f39a8299c8ec 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ConsolidatedAPIController.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ConsolidatedAPIController.java @@ -70,8 +70,7 @@ public Mono> getAllDataForFirstPageLoadF return consolidatedAPIService .getConsolidatedInfoForPageLoad(basePageId, baseApplicationId, refType, refName, ApplicationMode.EDIT) - .map(consolidatedAPIResponseDTO -> - new ResponseDTO<>(HttpStatus.OK.value(), consolidatedAPIResponseDTO, null)) + .map(consolidatedAPIResponseDTO -> new ResponseDTO<>(HttpStatus.OK, consolidatedAPIResponseDTO)) .tag("pageId", Objects.toString(basePageId)) .tag("applicationId", Objects.toString(baseApplicationId)) .tag("refType", Objects.toString(refType)) @@ -116,7 +115,7 @@ public Mono>> getAllDataF // if defaultPageId and applicationId are both null, then don't compute ETag if (isBlank(responseHash)) { ResponseDTO responseDTO = - new ResponseDTO<>(HttpStatus.OK.value(), consolidatedAPIResponseDTO, null); + new ResponseDTO<>(HttpStatus.OK, consolidatedAPIResponseDTO); return new ResponseEntity<>(responseDTO, HttpStatus.OK); } @@ -126,12 +125,12 @@ public Mono>> getAllDataF if (ifNoneMatch != null && ifNoneMatch.equals(responseHash)) { ResponseDTO responseDTO = - new ResponseDTO<>(HttpStatus.NOT_MODIFIED.value(), null, null); + new ResponseDTO<>(HttpStatus.NOT_MODIFIED, null); return new ResponseEntity<>(responseDTO, headers, HttpStatus.NOT_MODIFIED); } ResponseDTO responseDTO = - new ResponseDTO<>(HttpStatus.OK.value(), consolidatedAPIResponseDTO, null); + new ResponseDTO<>(HttpStatus.OK, consolidatedAPIResponseDTO); return new ResponseEntity<>(responseDTO, headers, HttpStatus.OK); }) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionCollectionControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionCollectionControllerCE.java index 633dbf2fe4f9..d5d2658fa46e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionCollectionControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionCollectionControllerCE.java @@ -55,7 +55,7 @@ public Mono> create(@Valid @RequestBody ActionC log.debug("Going to create action collection {}", resource.getClass().getName()); return layoutCollectionService .createCollection(resource) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -66,7 +66,7 @@ public Mono>> getAllUnpublishedActionColle return actionCollectionService .getPopulatedActionCollectionsByViewMode(params, false) .collectList() - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @@ -79,7 +79,7 @@ public Mono> moveActionCollection( actionCollectionMoveDTO.getDestinationPageId()); return layoutCollectionService .moveCollection(actionCollectionMoveDTO) - .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK.value(), actionCollection, null)); + .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK, actionCollection)); } @JsonView(Views.Public.class) @@ -89,7 +89,7 @@ public Mono> refactorActionCollectionName( refactorEntityNameDTO.setEntityType(EntityType.JS_OBJECT); return refactoringService .refactorEntityName(refactorEntityNameDTO) - .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.OK, created)); } @JsonView(Views.Public.class) @@ -100,7 +100,7 @@ public Mono>> getAllPublishedActionCol return actionCollectionService .getActionCollectionsForViewMode(applicationId, null) .collectList() - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @@ -110,7 +110,7 @@ public Mono> updateActionCollection( log.debug("Going to update action collection with id: {}", id); return layoutCollectionService .updateUnpublishedActionCollection(id, resource) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -120,7 +120,7 @@ public Mono> updateActionCollectionBody( log.debug("Going to update action collection body with id: {}", id); return layoutCollectionService .updateUnpublishedActionCollectionBody(id, resource) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -134,7 +134,7 @@ public Mono> refactorActionCollection( refactorEntityNameDTO.setEntityType(EntityType.JS_ACTION); return refactoringService .refactorEntityName(refactorEntityNameDTO) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -143,6 +143,6 @@ public Mono> deleteActionCollection(@PathVariab log.debug("Going to delete unpublished action collection with id: {}", id); return actionCollectionService .deleteUnpublishedActionCollection(id) - .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResource, null)); + .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK, deletedResource)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java index 62f437a4372a..39498b77a645 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ActionControllerCE.java @@ -58,7 +58,7 @@ public Mono> createAction( log.debug("Going to create resource {}", resource.getClass().getName()); return layoutActionService .createSingleAction(resource) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -69,7 +69,7 @@ public Mono> updateAction( log.debug("Going to update resource with branchedActionId: {}", branchedActionId); return layoutActionService .updateNewActionByBranchedId(branchedActionId, resource) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -82,7 +82,7 @@ public Mono> executeAction( return actionExecutionSolution .executeAction( partFlux, environmentId, serverWebExchange.getRequest().getHeaders(), Boolean.FALSE) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -93,9 +93,7 @@ public Mono> moveAction(@RequestBody @Valid ActionMoveDTO actionMoveDTO.getAction().getName(), actionMoveDTO.getAction().getPageId(), actionMoveDTO.getDestinationPageId()); - return layoutActionService - .moveAction(actionMoveDTO) - .map(action -> new ResponseDTO<>(HttpStatus.OK.value(), action, null)); + return layoutActionService.moveAction(actionMoveDTO).map(action -> new ResponseDTO<>(HttpStatus.OK, action)); } @JsonView(Views.Public.class) @@ -104,7 +102,7 @@ public Mono> refactorActionName(@RequestBody RefactorEnti refactorEntityNameDTO.setEntityType(EntityType.ACTION); return refactoringService .refactorEntityName(refactorEntityNameDTO) - .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.OK, created)); } @JsonView(Views.Public.class) @@ -114,7 +112,7 @@ public Mono>> getActionsForViewMode( return newActionService .getActionsForViewMode(branchedApplicationId) .collectList() - .map(actions -> new ResponseDTO<>(HttpStatus.OK.value(), actions, null)); + .map(actions -> new ResponseDTO<>(HttpStatus.OK, actions)); } @JsonView(Views.Public.class) @@ -124,7 +122,7 @@ public Mono> setExecuteOnLoad( log.debug("Going to set execute on load for action id {} to {}", branchedActionId, flag); return layoutActionService .setExecuteOnLoad(branchedActionId, flag) - .map(action -> new ResponseDTO<>(HttpStatus.OK.value(), action, null)); + .map(action -> new ResponseDTO<>(HttpStatus.OK, action)); } @JsonView(Views.Public.class) @@ -134,7 +132,7 @@ public Mono> deleteAction( log.debug("Going to delete unpublished action with id: {}, branchName: {}", id, branchName); return layoutActionService .deleteUnpublishedAction(id) - .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResource, null)); + .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK, deletedResource)); } /** @@ -154,6 +152,6 @@ public Mono>> getAllUnpublishedActions( return newActionService .getUnpublishedActionsExceptJs(params) .collectList() - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java index f1512a8866f9..663a5f913d8c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationControllerCE.java @@ -83,7 +83,7 @@ public Mono> create(@Valid @RequestBody ApplicationCrea log.debug("Going to create application in workspace {}", resource.workspaceId()); return applicationPageService .createApplication(resource.toApplication()) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -93,7 +93,7 @@ public Mono> publish( @RequestHeader(name = FieldName.BRANCH_NAME, required = false) String branchName) { return applicationPageService .publish(branchedApplicationId, true) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), true, null)); + .thenReturn(new ResponseDTO<>(HttpStatus.OK, true)); } @JsonView(Views.Public.class) @@ -102,7 +102,7 @@ public Mono> makeDefault( @PathVariable String branchedApplicationId, @PathVariable String branchedPageId) { return applicationPageService .makePageDefault(branchedApplicationId, branchedPageId) - .map(updatedApplication -> new ResponseDTO<>(HttpStatus.OK.value(), updatedApplication, null)); + .map(updatedApplication -> new ResponseDTO<>(HttpStatus.OK, updatedApplication)); } @JsonView(Views.Public.class) @@ -113,7 +113,7 @@ public Mono> reorderPage( @RequestParam Integer order) { return applicationPageService .reorderPage(branchedApplicationId, branchedPageId, order) - .map(updatedApplication -> new ResponseDTO<>(HttpStatus.OK.value(), updatedApplication, null)); + .map(updatedApplication -> new ResponseDTO<>(HttpStatus.OK, updatedApplication)); } @JsonView(Views.Public.class) @@ -122,7 +122,7 @@ public Mono> delete(@PathVariable String branchedApplic log.debug("Going to delete application with branchedApplicationId: {}", branchedApplicationId); return applicationPageService .deleteApplication(branchedApplicationId) - .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResource, null)); + .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK, deletedResource)); } @JsonView(Views.Public.class) @@ -132,16 +132,14 @@ public Mono>> findByWorkspaceIdAndRecentlyUsedOrde log.debug("Going to get all applications by workspace id {}", workspaceId); return service.findByWorkspaceIdAndBaseApplicationsInRecentlyUsedOrder(workspaceId) .collectList() - .map(applications -> new ResponseDTO<>(HttpStatus.OK.value(), applications, null)); + .map(applications -> new ResponseDTO<>(HttpStatus.OK, applications)); } @JsonView(Views.Public.class) @GetMapping(Url.RELEASE_ITEMS) public Mono> getReleaseItemsInformation() { log.debug("Going to get version release items"); - return userReleaseNotes - .getReleaseItems() - .map(applications -> new ResponseDTO<>(HttpStatus.OK.value(), applications, null)); + return userReleaseNotes.getReleaseItems().map(applications -> new ResponseDTO<>(HttpStatus.OK, applications)); } @JsonView(Views.Public.class) @@ -154,7 +152,7 @@ public Mono> shareApplication( applicationAccessDTO.getPublicAccess()); return service.changeViewAccessForAllBranchesByBranchedApplicationId( branchedApplicationId, applicationAccessDTO) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -162,14 +160,14 @@ public Mono> shareApplication( public Mono> cloneApplication(@PathVariable String branchedApplicationId) { return applicationPageService .cloneApplication(branchedApplicationId) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @GetMapping("/view/{branchedApplicationId}") public Mono> getApplicationInViewMode(@PathVariable String branchedApplicationId) { return service.getApplicationInViewMode(branchedApplicationId) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -178,7 +176,7 @@ public Mono> forkApplication( @PathVariable String branchedApplicationId, @PathVariable String workspaceId) { return applicationForkingService .forkApplicationToWorkspace(branchedApplicationId, workspaceId) - .map(fetchedResource -> new ResponseDTO<>(HttpStatus.OK.value(), fetchedResource, null)); + .map(fetchedResource -> new ResponseDTO<>(HttpStatus.OK, fetchedResource)); } @JsonView(Views.Public.class) @@ -201,7 +199,7 @@ public Mono> createSnapshot(@PathVariable String branchedAp return applicationSnapshotService .createApplicationSnapshot(branchedApplicationId) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -212,7 +210,7 @@ public Mono> getSnapshotWithoutAppli return applicationSnapshotService .getWithoutDataByBranchedApplicationId(branchedApplicationId) - .map(applicationSnapshot -> new ResponseDTO<>(HttpStatus.OK.value(), applicationSnapshot, null)); + .map(applicationSnapshot -> new ResponseDTO<>(HttpStatus.OK, applicationSnapshot)); } @JsonView(Views.Public.class) @@ -222,7 +220,7 @@ public Mono> deleteSnapshotWithoutApplicationJson(@PathVari return applicationSnapshotService .deleteSnapshot(branchedApplicationId) - .map(isDeleted -> new ResponseDTO<>(HttpStatus.OK.value(), isDeleted, null)); + .map(isDeleted -> new ResponseDTO<>(HttpStatus.OK, isDeleted)); } @JsonView(Views.Public.class) @@ -232,7 +230,7 @@ public Mono> restoreSnapshot(@PathVariable String branc return applicationSnapshotService .restoreSnapshot(branchedApplicationId) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -244,7 +242,7 @@ public Mono> importApplicationFromFile( log.debug("Going to import application in workspace with id: {}", workspaceId); return fileMono.flatMap(file -> importService.extractArtifactExchangeJsonAndSaveArtifact( file, workspaceId, branchedApplicationId)) - .map(fetchedResource -> new ResponseDTO<>(HttpStatus.OK.value(), fetchedResource, null)); + .map(fetchedResource -> new ResponseDTO<>(HttpStatus.OK, fetchedResource)); } @JsonView(Views.Public.class) @@ -253,14 +251,13 @@ public Mono> generateSSHKeyPair( @PathVariable String branchedApplicationId, @RequestParam(required = false) String keyType) { return artifactService .createOrUpdateSshKeyPair(ArtifactType.APPLICATION, branchedApplicationId, keyType) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @GetMapping("/ssh-keypair/{branchedApplicationId}") public Mono> getSSHKey(@PathVariable String branchedApplicationId) { - return service.getSshKey(branchedApplicationId) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + return service.getSshKey(branchedApplicationId).map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -269,7 +266,7 @@ public Mono> update( @PathVariable String branchedApplicationId, @RequestBody Application resource) { log.debug("Going to update resource from base controller with id: {}", branchedApplicationId); return service.updateApplicationWithPresets(branchedApplicationId, resource) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -278,7 +275,7 @@ public Mono> setCurrentTheme( @PathVariable String branchedApplicationId, @PathVariable String themeId) { return themeService .changeCurrentTheme(themeId, branchedApplicationId) - .map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null)); + .map(theme -> new ResponseDTO<>(HttpStatus.OK, theme)); } @JsonView(Views.Public.class) @@ -287,7 +284,7 @@ public Mono>> getUnConfiguredDatasource( @PathVariable String workspaceId, @RequestParam(name = "defaultApplicationId") String baseApplicationId) { return importService .findDatasourceByArtifactId(workspaceId, baseApplicationId, APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -295,14 +292,14 @@ public Mono>> getUnConfiguredDatasource( public Mono> uploadAppNavigationLogo( @PathVariable String branchedApplicationId, @RequestPart("file") Mono fileMono) { return fileMono.flatMap(part -> service.saveAppNavigationLogo(branchedApplicationId, part)) - .map(url -> new ResponseDTO<>(HttpStatus.OK.value(), url, null)); + .map(url -> new ResponseDTO<>(HttpStatus.OK, url)); } @JsonView(Views.Public.class) @DeleteMapping("/{branchedApplicationId}/logo") public Mono> deleteAppNavigationLogo(@PathVariable String branchedApplicationId) { return service.deleteAppNavigationLogo(branchedApplicationId) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), null, null)); + .thenReturn(new ResponseDTO<>(HttpStatus.OK, null)); } @JsonView(Views.Public.class) @@ -316,7 +313,7 @@ public Mono> exportApplicationPartially( // params - contains ids of jsLib, actions and datasourceIds to be exported return partialExportService .getPartialExportResources(branchedApplicationId, branchedPageId, fileDTO) - .map(fetchedResource -> new ResponseDTO<>(HttpStatus.OK.value(), fetchedResource, null)); + .map(fetchedResource -> new ResponseDTO<>(HttpStatus.OK, fetchedResource)); } @JsonView(Views.Public.class) @@ -330,7 +327,7 @@ public Mono> importApplicationPartially( @RequestParam(name = FieldName.PAGE_ID) String branchedPageId) { return fileMono.flatMap(fileData -> partialImportService.importResourceInPage( workspaceId, branchedApplicationId, branchedPageId, null, fileData)) - .map(fetchedResource -> new ResponseDTO<>(HttpStatus.CREATED.value(), fetchedResource, null)); + .map(fetchedResource -> new ResponseDTO<>(HttpStatus.CREATED, fetchedResource)); } @JsonView(Views.Public.class) @@ -338,6 +335,6 @@ public Mono> importApplicationPartially( public Mono> importBlock(@RequestBody BuildingBlockDTO buildingBlockDTO) { return partialImportService .importBuildingBlock(buildingBlockDTO) - .map(fetchedResource -> new ResponseDTO<>(HttpStatus.CREATED.value(), fetchedResource, null)); + .map(fetchedResource -> new ResponseDTO<>(HttpStatus.CREATED, fetchedResource)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java index 43b3f6a8507c..e7b48cf1f2b4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ApplicationTemplateControllerCE.java @@ -34,7 +34,7 @@ public ApplicationTemplateControllerCE(ApplicationTemplateService applicationTem public Mono>> getAll() { return applicationTemplateService .getActiveTemplates(null) - .map(templates -> new ResponseDTO<>(HttpStatus.OK.value(), templates, null)); + .map(templates -> new ResponseDTO<>(HttpStatus.OK, templates)); } @JsonView(Views.Public.class) @@ -42,7 +42,7 @@ public Mono>> getAll() { public Mono> getTemplateDetails(@PathVariable String templateId) { return applicationTemplateService .getTemplateDetails(templateId) - .map(templates -> new ResponseDTO<>(HttpStatus.OK.value(), templates, null)); + .map(templates -> new ResponseDTO<>(HttpStatus.OK, templates)); } @JsonView(Views.Public.class) @@ -52,15 +52,13 @@ public Mono>> getSimilarTemplates( return applicationTemplateService .getSimilarTemplates(templateId, params) .collectList() - .map(templates -> new ResponseDTO<>(HttpStatus.OK.value(), templates, null)); + .map(templates -> new ResponseDTO<>(HttpStatus.OK, templates)); } @JsonView(Views.Public.class) @GetMapping("filters") public Mono> getFilters() { - return applicationTemplateService - .getFilters() - .map(filters -> new ResponseDTO<>(HttpStatus.OK.value(), filters, null)); + return applicationTemplateService.getFilters().map(filters -> new ResponseDTO<>(HttpStatus.OK, filters)); } @JsonView(Views.Public.class) @@ -69,7 +67,7 @@ public Mono> importApplicationFromTemplate( @PathVariable String templateId, @PathVariable String workspaceId) { return applicationTemplateService .importApplicationFromTemplate(templateId, workspaceId) - .map(importedApp -> new ResponseDTO<>(HttpStatus.OK.value(), importedApp, null)); + .map(importedApp -> new ResponseDTO<>(HttpStatus.OK, importedApp)); } @JsonView(Views.Public.class) @@ -81,7 +79,7 @@ public Mono> mergeTemplateWithApplication( @RequestBody(required = false) List pagesToImport) { return applicationTemplateService .mergeTemplateWithApplication(templateId, branchedApplicationId, workspaceId, pagesToImport) - .map(importedApp -> new ResponseDTO<>(HttpStatus.OK.value(), importedApp, null)); + .map(importedApp -> new ResponseDTO<>(HttpStatus.OK, importedApp)); } @JsonView(Views.Public.class) @@ -89,7 +87,7 @@ public Mono> mergeTemplateWithApplication( public Mono> publishAsCommunityTemplate(@RequestBody TemplateDTO resource) { return applicationTemplateService .publishAsCommunityTemplate(resource) - .map(template -> new ResponseDTO<>(HttpStatus.OK.value(), template, null)); + .map(template -> new ResponseDTO<>(HttpStatus.OK, template)); } @JsonView(Views.Public.class) @@ -97,6 +95,6 @@ public Mono> publishAsCommunityTemplate(@RequestBody Te public Mono> publishAppsmithTemplate(@RequestBody TemplateDTO resource) { return applicationTemplateService .publishAppsmithTemplate(resource) - .map(template -> new ResponseDTO<>(HttpStatus.OK.value(), template, null)); + .map(template -> new ResponseDTO<>(HttpStatus.OK, template)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ConfigControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ConfigControllerCE.java index 1ed7f46f770e..a0580ea45b88 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ConfigControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ConfigControllerCE.java @@ -26,12 +26,12 @@ public ConfigControllerCE(ConfigService service) { @JsonView(Views.Public.class) @GetMapping("/name/{name}") public Mono> getByName(@PathVariable String name) { - return service.getByName(name).map(resource -> new ResponseDTO<>(HttpStatus.OK.value(), resource, null)); + return service.getByName(name).map(resource -> new ResponseDTO<>(HttpStatus.OK, resource)); } @JsonView(Views.Public.class) @PutMapping("/name/{name}") public Mono> updateByName(@PathVariable String name, @RequestBody Config config) { - return service.updateByName(config).map(resource -> new ResponseDTO<>(HttpStatus.OK.value(), resource, null)); + return service.updateByName(config).map(resource -> new ResponseDTO<>(HttpStatus.OK, resource)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/CustomJSLibControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/CustomJSLibControllerCE.java index b847a402609b..f71b6e2ea918 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/CustomJSLibControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/CustomJSLibControllerCE.java @@ -47,7 +47,7 @@ public Mono> addJSLibToApplication( branchedApplicationId); return customJSLibService .addJSLibsToContext(branchedApplicationId, contextType, Set.of(customJSLib), isForceInstall) - .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK.value(), actionCollection, null)); + .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK, actionCollection)); } @JsonView(Views.Public.class) @@ -64,7 +64,7 @@ public Mono> removeJSLibFromApplication( branchedApplicationId); return customJSLibService .removeJSLibFromContext(branchedApplicationId, contextType, customJSLib, isForceRemove) - .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK.value(), actionCollection, null)); + .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK, actionCollection)); } @JsonView(Views.Public.class) @@ -78,7 +78,7 @@ public Mono>> getAllUserInstalledJSLibInApplicatio branchedContextId); return customJSLibService .getAllJSLibsInContext(branchedContextId, contextType, false) - .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK.value(), actionCollection, null)); + .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK, actionCollection)); } @JsonView(Views.Public.class) @@ -94,6 +94,6 @@ public Mono>> getAllUserInstalledJSLibInApplicatio branchName); return customJSLibService .getAllJSLibsInContext(branchedContextId, contextType, true) - .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK.value(), actionCollection, null)); + .map(actionCollection -> new ResponseDTO<>(HttpStatus.OK, actionCollection)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java index 73db8c5ae0f4..9fa60a3c23f3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/DatasourceControllerCE.java @@ -62,7 +62,7 @@ public Mono>> getAll(@RequestParam MultiValueMap new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @@ -70,9 +70,7 @@ public Mono>> getAll(@RequestParam MultiValueMap> create(@Valid @RequestBody @JsonView(FromRequest.class) Datasource resource) { log.debug("Going to create resource from datasource controller"); - return datasourceService - .create(resource) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + return datasourceService.create(resource).map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -84,7 +82,7 @@ public Mono> update( log.debug("Going to update resource from datasource controller with id: {}", id); return datasourceService .updateDatasource(id, datasource, environmentId, Boolean.TRUE) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -99,7 +97,7 @@ public Mono> updateDatasourceStorages( return datasourceService .updateDatasourceStorage(datasourceStorageDTO, activeEnvironmentId, Boolean.TRUE) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @@ -108,7 +106,7 @@ public Mono> delete(@PathVariable String id) { log.debug("Going to delete resource from datasource controller with id: {}", id); return datasourceService .archiveById(id) - .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResource, null)); + .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK, deletedResource)); } @JsonView(Views.Public.class) @@ -120,7 +118,7 @@ public Mono> testDatasource( log.debug("Going to test the datasource with id: {}", datasourceStorageDTO.getDatasourceId()); return datasourceService .testDatasource(datasourceStorageDTO, activeEnvironmentId) - .map(testResult -> new ResponseDTO<>(HttpStatus.OK.value(), testResult, null)); + .map(testResult -> new ResponseDTO<>(HttpStatus.OK, testResult)); } @JsonView(Views.Public.class) @@ -132,7 +130,7 @@ public Mono> getStructure( log.debug("Going to get structure for datasource with id: '{}'.", datasourceId); return datasourceStructureSolution .getStructure(datasourceId, BooleanUtils.isTrue(ignoreCache), environmentId) - .map(structure -> new ResponseDTO<>(HttpStatus.OK.value(), structure, null)); + .map(structure -> new ResponseDTO<>(HttpStatus.OK, structure)); } @JsonView(Views.Public.class) @@ -169,9 +167,7 @@ public Mono getAccessToken(AuthorizationCodeCallbackDTO callbackDTO, Serve @JsonView(Views.Public.class) @GetMapping(Url.MOCKS) public Mono>> getMockDataSets() { - return mockDataService - .getMockDataSet() - .map(config -> new ResponseDTO<>(HttpStatus.OK.value(), config.getMockdbs(), null)); + return mockDataService.getMockDataSet().map(config -> new ResponseDTO<>(HttpStatus.OK, config.getMockdbs())); } @JsonView(Views.Public.class) @@ -181,7 +177,7 @@ public Mono> createMockDataSet( @RequestHeader(name = FieldName.HEADER_ENVIRONMENT_ID, required = false) String environmentId) { return mockDataService .createMockDataSet(mockDataSource, environmentId) - .map(datasource -> new ResponseDTO<>(HttpStatus.OK.value(), datasource, null)); + .map(datasource -> new ResponseDTO<>(HttpStatus.OK, datasource)); } @JsonView(Views.Public.class) @@ -193,7 +189,7 @@ public Mono> trigger( log.debug("Trigger received for datasource {}", datasourceId); return datasourceTriggerSolution .trigger(datasourceId, environmentId, triggerRequestDTO) - .map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK.value(), triggerResultDTO, null)); + .map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK, triggerResultDTO)); } @JsonView(Views.Public.class) @@ -205,6 +201,6 @@ public Mono> getSchemaPreviewData( log.debug("Going to get schema preview data for datasource with id: '{}'.", datasourceId); return datasourceStructureSolution .getSchemaPreviewData(datasourceId, environmentId, template) - .map(actionExecutionResult -> new ResponseDTO<>(HttpStatus.OK.value(), actionExecutionResult, null)); + .map(actionExecutionResult -> new ResponseDTO<>(HttpStatus.OK, actionExecutionResult)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java index bb9c05689840..e2976a76dd2a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/GitControllerCE.java @@ -66,7 +66,7 @@ public class GitControllerCE { public Mono>> saveGitProfile(@RequestBody GitProfile gitProfile) { log.debug("Going to add default git profile for user"); return service.updateOrCreateGitProfileForCurrentUser(gitProfile) - .map(response -> new ResponseDTO<>(HttpStatus.OK.value(), response, null)); + .map(response -> new ResponseDTO<>(HttpStatus.OK, response)); } @JsonView(Views.Public.class) @@ -75,28 +75,28 @@ public Mono>> saveGitProfile( @PathVariable String baseApplicationId, @RequestBody GitProfile gitProfile) { log.debug("Going to add repo specific git profile for application: {}", baseApplicationId); return service.updateOrCreateGitProfileForCurrentUser(gitProfile, baseApplicationId) - .map(response -> new ResponseDTO<>(HttpStatus.ACCEPTED.value(), response, null)); + .map(response -> new ResponseDTO<>(HttpStatus.ACCEPTED, response)); } @JsonView(Views.Public.class) @GetMapping("/profile/default") public Mono> getDefaultGitConfigForUser() { return service.getDefaultGitProfileOrCreateIfEmpty() - .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK.value(), gitConfigResponse, null)); + .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK, gitConfigResponse)); } @JsonView(Views.Public.class) @GetMapping("/profile/app/{baseApplicationId}") public Mono> getGitConfigForUser(@PathVariable String baseApplicationId) { return service.getGitProfileForUser(baseApplicationId) - .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK.value(), gitConfigResponse, null)); + .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK, gitConfigResponse)); } @JsonView({Views.Metadata.class}) @GetMapping("/metadata/app/{baseArtifactId}") public Mono> getGitMetadata(@PathVariable String baseArtifactId) { return service.getGitArtifactMetadata(baseArtifactId, ArtifactType.APPLICATION) - .map(metadata -> new ResponseDTO<>(HttpStatus.OK.value(), metadata, null)); + .map(metadata -> new ResponseDTO<>(HttpStatus.OK, metadata)); } @JsonView(Views.Public.class) @@ -107,7 +107,7 @@ public Mono> connectApplicationToRemoteRepo( @RequestHeader("Origin") String originHeader) { return service.connectArtifactToGit(baseApplicationId, gitConnectDTO, originHeader, ArtifactType.APPLICATION) .map(artifact -> (Application) artifact) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -119,7 +119,7 @@ public Mono> commit( @RequestParam(required = false, defaultValue = "false") Boolean doAmend) { log.debug("Going to commit branchedApplicationId {}", branchedApplicationId); return service.commitArtifact(commitDTO, branchedApplicationId, doAmend, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -128,7 +128,7 @@ public Mono> commit( public Mono> push(@PathVariable String branchedApplicationId) { log.debug("Going to push branchedApplicationId {}", branchedApplicationId); return service.pushArtifact(branchedApplicationId, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -144,7 +144,7 @@ public Mono> createBranch( srcBranch); return service.createBranch(branchedApplicationId, branchDTO, ArtifactType.APPLICATION) .map(artifact -> (Application) artifact) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -155,7 +155,7 @@ public Mono> checkoutBranch( log.debug("Going to checkout to branch {} application {} ", branchName, branchedApplicationId); return service.checkoutBranch(branchedApplicationId, branchName, true, ArtifactType.APPLICATION) .map(artifact -> (Application) artifact) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -164,7 +164,7 @@ public Mono> disconnectFromRemote(@PathVariable String log.debug("Going to remove the remoteUrl for application {}", branchedApplicationId); return service.detachRemote(branchedApplicationId, ArtifactType.APPLICATION) .map(artifact -> (Application) artifact) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -172,7 +172,7 @@ public Mono> disconnectFromRemote(@PathVariable String public Mono> pull(@PathVariable String branchedApplicationId) { log.debug("Going to pull the latest for branchedApplicationId {}", branchedApplicationId); return service.pullArtifact(branchedApplicationId, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -183,7 +183,7 @@ public Mono>> branch( log.debug("Going to get branch list for application {}", branchedApplicationId); return service.listBranchForArtifact( branchedApplicationId, BooleanUtils.isTrue(pruneBranches), ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -193,7 +193,7 @@ public Mono> getStatus( @RequestParam(required = false, defaultValue = "true") Boolean compareRemote) { log.debug("Going to get status for default branchedApplicationId {}", branchedApplicationId); return service.getStatus(branchedApplicationId, compareRemote, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -201,7 +201,7 @@ public Mono> getStatus( public Mono> fetchRemoteChanges(@PathVariable String branchedApplicationId) { log.debug("Going to compare with remote for default branchedApplicationId {}", branchedApplicationId); return service.fetchRemoteChanges(branchedApplicationId, true, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -214,7 +214,7 @@ public Mono> merge( gitMergeDTO.getDestinationBranch(), branchedApplicationId); return service.mergeBranch(branchedApplicationId, gitMergeDTO, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -227,13 +227,13 @@ public Mono> mergeStatus( gitMergeDTO.getDestinationBranch(), branchedApplicationId); return service.isBranchMergeable(branchedApplicationId, gitMergeDTO, ArtifactType.APPLICATION) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @GetMapping("/import/keys") public Mono> generateKeyForGitImport(@RequestParam(required = false) String keyType) { - return service.generateSSHKey(keyType).map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + return service.generateSSHKey(keyType).map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -242,7 +242,7 @@ public Mono> importApplicationFromGit( @PathVariable String workspaceId, @RequestBody GitConnectDTO gitConnectDTO) { return service.importArtifactFromGit(workspaceId, gitConnectDTO, ArtifactType.APPLICATION) .map(artifactImportDTO -> (ApplicationImportDTO) artifactImportDTO) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -252,7 +252,7 @@ public Mono> deleteBranch( log.debug("Going to delete branch {} for baseApplicationId {}", branchName, baseArtifactId); return service.deleteBranch(baseArtifactId, branchName, ArtifactType.APPLICATION) .map(artifact -> (Application) artifact) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -261,7 +261,7 @@ public Mono> discardChanges(@PathVariable String branch log.debug("Going to discard changes for branchedApplicationId {}", branchedApplicationId); return service.discardChanges(branchedApplicationId, ArtifactType.APPLICATION) .map(artifact -> (Application) artifact) - .map(result -> new ResponseDTO<>((HttpStatus.OK.value()), result, null)); + .map(result -> new ResponseDTO<>((HttpStatus.OK), result)); } @JsonView(Views.Public.class) @@ -269,13 +269,13 @@ public Mono> discardChanges(@PathVariable String branch public Mono>> getSupportedKeys() { log.debug("Going to list the list of supported keys"); return Mono.just(GitDeployKeyGenerator.getSupportedProtocols()) - .map(gitDeployKeyDTOS -> new ResponseDTO<>(HttpStatus.OK.value(), gitDeployKeyDTOS, null)); + .map(gitDeployKeyDTOS -> new ResponseDTO<>(HttpStatus.OK, gitDeployKeyDTOS)); } @JsonView(Views.Public.class) @GetMapping("/doc-urls") public Mono>> getGitDocs() { - return service.getGitDocUrls().map(gitDocDTO -> new ResponseDTO<>(HttpStatus.OK.value(), gitDocDTO, null)); + return service.getGitDocUrls().map(gitDocDTO -> new ResponseDTO<>(HttpStatus.OK, gitDocDTO)); } @JsonView(Views.Public.class) @@ -285,14 +285,14 @@ public Mono>> updateProtectedBranches( @RequestBody @Valid BranchProtectionRequestDTO branchProtectionRequestDTO) { return service.updateProtectedBranches( baseArtifactId, branchProtectionRequestDTO.getBranchNames(), ArtifactType.APPLICATION) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @GetMapping("/branch/app/{baseArtifactId}/protected") public Mono>> getProtectedBranches(@PathVariable String baseArtifactId) { return service.getProtectedBranches(baseArtifactId, ArtifactType.APPLICATION) - .map(list -> new ResponseDTO<>(HttpStatus.OK.value(), list, null)); + .map(list -> new ResponseDTO<>(HttpStatus.OK, list)); } @JsonView(Views.Public.class) @@ -300,7 +300,7 @@ public Mono>> getProtectedBranches(@PathVariable String public Mono> autoCommitApplication(@PathVariable String branchedApplicationId) { return autoCommitService .autoCommitApplication(branchedApplicationId) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @@ -309,13 +309,13 @@ public Mono> getAutoCommitProgress( @PathVariable String baseApplicationId, @RequestHeader(name = FieldName.BRANCH_NAME, required = false) String branchName) { return service.getAutoCommitProgress(baseApplicationId, branchName, ArtifactType.APPLICATION) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @PatchMapping("/auto-commit/toggle/app/{baseArtifactId}") public Mono> toggleAutoCommitEnabled(@PathVariable String baseArtifactId) { return service.toggleAutoCommitEnabled(baseArtifactId, ArtifactType.APPLICATION) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/HealthCheckControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/HealthCheckControllerCE.java index 846514fd6825..898c854abe4f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/HealthCheckControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/HealthCheckControllerCE.java @@ -22,6 +22,6 @@ public class HealthCheckControllerCE { @GetMapping public Mono> getHealth() { log.debug("Checking server health ..."); - return healthCheckService.getHealth().map(health -> new ResponseDTO<>(HttpStatus.OK.value(), health, null)); + return healthCheckService.getHealth().map(health -> new ResponseDTO<>(HttpStatus.OK, health)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/InstanceAdminControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/InstanceAdminControllerCE.java index ab08fec81989..904a54b0353e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/InstanceAdminControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/InstanceAdminControllerCE.java @@ -33,7 +33,7 @@ public class InstanceAdminControllerCE { @GetMapping("/env") public Mono>> getAll() { log.debug("Getting all env configuration"); - return envManager.getAllNonEmpty().map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + return envManager.getAllNonEmpty().map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @Deprecated @@ -44,9 +44,7 @@ public Mono>> getAll() { public Mono> saveEnvChangesJSON( @Valid @RequestBody Map changes, @RequestHeader("Origin") String originHeader) { log.debug("Applying env updates {}", changes.keySet()); - return envManager - .applyChanges(changes, originHeader) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), null, null)); + return envManager.applyChanges(changes, originHeader).thenReturn(new ResponseDTO<>(HttpStatus.OK, null)); } @JsonView(Views.Public.class) @@ -58,20 +56,20 @@ public Mono> saveEnvChangesMultipartFormData( log.debug("Applying env updates from form data"); return exchange.getMultipartData() .flatMap(formData -> envManager.applyChangesFromMultipartFormData(formData, originHeader)) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), null, null)); + .thenReturn(new ResponseDTO<>(HttpStatus.OK, null)); } @JsonView(Views.Public.class) @PostMapping("/restart") public Mono> restart() { log.debug("Received restart request"); - return envManager.restart().thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), true, null)); + return envManager.restart().thenReturn(new ResponseDTO<>(HttpStatus.OK, true)); } @JsonView(Views.Public.class) @PostMapping("/send-test-email") public Mono> sendTestEmail(@RequestBody @Valid TestEmailConfigRequestDTO requestDTO) { log.debug("Sending test email"); - return envManager.sendTestEmail(requestDTO).thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), true, null)); + return envManager.sendTestEmail(requestDTO).thenReturn(new ResponseDTO<>(HttpStatus.OK, true)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java index a49f25596c4b..c6585bf1bf2f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/LayoutControllerCE.java @@ -47,7 +47,7 @@ public LayoutControllerCE( @GetMapping("/{layoutId}/pages/{branchedPageId}") public Mono> getLayout(@PathVariable String branchedPageId, @PathVariable String layoutId) { return service.getLayout(branchedPageId, layoutId, false) - .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.OK, created)); } @JsonView(Views.Public.class) @@ -57,7 +57,7 @@ public Mono> updateMultipleLayouts( log.debug("update multiple layout received for applicationId {}", applicationId); return updateLayoutService .updateMultipleLayouts(applicationId, request) - .map(updatedCount -> new ResponseDTO<>(HttpStatus.OK.value(), updatedCount, null)); + .map(updatedCount -> new ResponseDTO<>(HttpStatus.OK, updatedCount)); } @JsonView(Views.Public.class) @@ -70,14 +70,14 @@ public Mono> updateLayout( log.debug("update layout received for page {}", branchedPageId); return updateLayoutService .updateLayout(branchedPageId, applicationId, layoutId, dto.toLayout()) - .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.OK, created)); } @JsonView(Views.Public.class) @GetMapping("/{layoutId}/pages/{branchedPageId}/view") public Mono> getLayoutView(@PathVariable String branchedPageId, @PathVariable String layoutId) { return service.getLayout(branchedPageId, layoutId, true) - .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.OK, created)); } @JsonView(Views.Public.class) @@ -86,6 +86,6 @@ public Mono> refactorWidgetName(@RequestBody RefactorEnti refactorEntityNameDTO.setEntityType(EntityType.WIDGET); return refactoringService .refactorEntityName(refactorEntityNameDTO) - .map(created -> new ResponseDTO<>(HttpStatus.OK.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.OK, created)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/OrganizationControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/OrganizationControllerCE.java index 2e2a8c01669b..96738de46037 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/OrganizationControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/OrganizationControllerCE.java @@ -40,14 +40,13 @@ public OrganizationControllerCE(OrganizationService service) { @GetMapping("/current") public Mono> getOrganizationConfig() { log.debug("Attempting to retrieve organization configuration ... "); - return service.getOrganizationConfiguration() - .map(resource -> new ResponseDTO<>(HttpStatus.OK.value(), resource, null)); + return service.getOrganizationConfiguration().map(resource -> new ResponseDTO<>(HttpStatus.OK, resource)); } @PutMapping("") public Mono> updateOrganizationConfiguration( @RequestBody OrganizationConfiguration organizationConfiguration) { return service.updateDefaultOrganizationConfiguration(organizationConfiguration) - .map(organization -> new ResponseDTO<>(HttpStatus.OK.value(), organization, null)); + .map(organization -> new ResponseDTO<>(HttpStatus.OK, organization)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PageControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PageControllerCE.java index 1985ce71d9dc..e2363bfcdce4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PageControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PageControllerCE.java @@ -52,7 +52,7 @@ public Mono> createPage(@Valid @RequestBody PageCreationDTO log.debug("Going to create page {}", page.name()); return applicationPageService .createPage(page.toPageDTO()) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -64,7 +64,7 @@ public Mono> createCRUDPage( log.debug("Going to create crud-page in application {}", resource.getApplicationId()); return createDBTablePageSolution .createPageFromDBTable(null, resource, environmentId, null, Boolean.TRUE) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -77,7 +77,7 @@ public Mono> createCRUDPage( log.debug("Going to create CRUD page {}", branchedPageId); return createDBTablePageSolution .createPageFromDBTable(branchedPageId, resource, environmentId, null, Boolean.TRUE) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @Deprecated @@ -87,7 +87,7 @@ public Mono> getPageNamesByApplicationId( @PathVariable String branchedApplicationId) { return newPageService .findApplicationPagesByBranchedApplicationIdAndViewMode(branchedApplicationId, false, true) - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @@ -97,7 +97,7 @@ public Mono> getPageNamesByApplicationIdInViewM @RequestHeader(name = FieldName.BRANCH_NAME, required = false) String branchName) { return newPageService .findApplicationPagesByBranchedApplicationIdAndViewMode(branchedApplicationId, true, true) - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @@ -107,7 +107,7 @@ public Mono> getPageById( @RequestParam(required = false, defaultValue = "false") Boolean migrateDsl) { return applicationPageService .getPageAndMigrateDslByBranchedPageId(branchedPageId, false, migrateDsl) - .map(page -> new ResponseDTO<>(HttpStatus.OK.value(), page, null)); + .map(page -> new ResponseDTO<>(HttpStatus.OK, page)); } @JsonView(Views.Public.class) @@ -117,7 +117,7 @@ public Mono> getPageView( @RequestParam(required = false, defaultValue = "false") Boolean migrateDsl) { return applicationPageService .getPageAndMigrateDslByBranchedPageId(branchedPageId, true, migrateDsl) - .map(page -> new ResponseDTO<>(HttpStatus.OK.value(), page, null)); + .map(page -> new ResponseDTO<>(HttpStatus.OK, page)); } /** @@ -135,7 +135,7 @@ public Mono> deletePage(@PathVariable String branchedPageId log.debug("Going to delete page with id: {}", branchedPageId); return applicationPageService .deleteUnpublishedPage(branchedPageId) - .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResource, null)); + .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK, deletedResource)); } @JsonView(Views.Public.class) @@ -143,7 +143,7 @@ public Mono> deletePage(@PathVariable String branchedPageId public Mono> clonePage(@PathVariable String branchedPageId) { return applicationPageService .clonePage(branchedPageId) - .map(page -> new ResponseDTO<>(HttpStatus.CREATED.value(), page, null)); + .map(page -> new ResponseDTO<>(HttpStatus.CREATED, page)); } @JsonView(Views.Public.class) @@ -153,7 +153,7 @@ public Mono> updatePage( log.debug("Going to update page with id: {}", branchedPageId); return newPageService .updatePage(branchedPageId, resource.toPageDTO()) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } /** @@ -180,7 +180,7 @@ public Mono> getAllPages( mode); return newPageService .findApplicationPages(branchedApplicationId, branchedPageId, mode) - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @@ -191,6 +191,6 @@ public Mono> updateDependencyMap( @RequestHeader(name = FieldName.BRANCH_NAME, required = false) String branchName) { return newPageService .updateDependencyMap(defaultPageId, dependencyMap, RefType.branch, branchName) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PluginControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PluginControllerCE.java index d6323f8b68f6..381186074067 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PluginControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/PluginControllerCE.java @@ -44,21 +44,19 @@ public Mono>> getAll(@RequestParam String workspaceId) log.debug("Getting all plugins in workspace {}", workspaceId); return service.getInWorkspace(workspaceId) .collectList() - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } @JsonView(Views.Public.class) @GetMapping("/{pluginId}/form") public Mono> getDatasourceForm(@PathVariable String pluginId) { - return service.getFormConfig(pluginId).map(form -> new ResponseDTO<>(HttpStatus.OK.value(), form, null)); + return service.getFormConfig(pluginId).map(form -> new ResponseDTO<>(HttpStatus.OK, form)); } @JsonView(Views.Public.class) @GetMapping("/default/icons") public Mono>> getDefaultPluginIcons() { - return service.getDefaultPluginIcons() - .collectList() - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + return service.getDefaultPluginIcons().collectList().map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @@ -75,7 +73,7 @@ public Mono> trigger( environmentId, triggerRequestDTO, serverWebExchange.getRequest().getHeaders()) - .map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK.value(), triggerResultDTO, null)); + .map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK, triggerResultDTO)); } @JsonView(Views.Public.class) @@ -96,6 +94,6 @@ public Mono> triggerMultipart( filePartFlux, requestType, serverWebExchange.getRequest().getHeaders()) - .map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK.value(), triggerResultDTO, null)); + .map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK, triggerResultDTO)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ProductFeatureAlertControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ProductFeatureAlertControllerCE.java index 48ece64f5c68..b13843a0d8e8 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ProductFeatureAlertControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ProductFeatureAlertControllerCE.java @@ -25,9 +25,9 @@ public ProductFeatureAlertControllerCE(ProductAlertService productAlertService) public Mono> generateCode() { return productAlertService.getSingleApplicableMessage().map(messages -> { if (messages.size() > 0) { - return new ResponseDTO<>(HttpStatus.OK.value(), messages.get(0), null); + return new ResponseDTO<>(HttpStatus.OK, messages.get(0)); } else { - return new ResponseDTO<>(HttpStatus.OK.value(), new ProductAlertResponseDTO(), null); + return new ResponseDTO<>(HttpStatus.OK, new ProductAlertResponseDTO()); } }); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java index 21099164b830..9a73b444fb77 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/RestApiImportControllerCE.java @@ -50,6 +50,6 @@ public Mono> create( } return service.importAction(input, contextType, contextId, name, workspaceId) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SaasControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SaasControllerCE.java index ce811e005057..3b93c99a43d3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SaasControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SaasControllerCE.java @@ -52,7 +52,7 @@ public Mono> getAppsmithToken( requestAppsmithTokenDTO, serverWebExchange.getRequest().getHeaders(), importForGit) - .map(token -> new ResponseDTO<>(HttpStatus.OK.value(), token, null)); + .map(token -> new ResponseDTO<>(HttpStatus.OK, token)); } @JsonView(Views.Public.class) @@ -65,7 +65,7 @@ public Mono> getAccessToken( log.debug("Received callback for an OAuth2 authorization request"); return authenticationService .getAccessTokenFromCloud(datasourceId, environmentId, appsmithToken) - .map(datasource -> new ResponseDTO<>(HttpStatus.OK.value(), datasource, null)); + .map(datasource -> new ResponseDTO<>(HttpStatus.OK, datasource)); } @GetMapping("authorize") diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SearchEntityControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SearchEntityControllerCE.java index c7b98726a737..9736e4e9181a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SearchEntityControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/SearchEntityControllerCE.java @@ -33,6 +33,6 @@ public Mono> getAllUnpublishedActionCollections( log.debug("Going to search for entities with search string: {}", keyword); return searchEntitySolution .searchEntity(entities, keyword, page, size, Boolean.TRUE) - .map(resources -> new ResponseDTO<>(HttpStatus.OK.value(), resources, null)); + .map(resources -> new ResponseDTO<>(HttpStatus.OK, resources)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java index 1cc71a339086..44c4c3335629 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/ThemeControllerCE.java @@ -34,7 +34,7 @@ public class ThemeControllerCE { public Mono>> getApplicationThemes(@PathVariable String branchedApplicationId) { return service.getApplicationThemes(branchedApplicationId) .collectList() - .map(themes -> new ResponseDTO<>(HttpStatus.OK.value(), themes, null)); + .map(themes -> new ResponseDTO<>(HttpStatus.OK, themes)); } @JsonView(Views.Public.class) @@ -43,7 +43,7 @@ public Mono> getCurrentTheme( @PathVariable String branchedApplicationId, @RequestParam(required = false, defaultValue = "EDIT") ApplicationMode mode) { return service.getApplicationTheme(branchedApplicationId, mode) - .map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null)); + .map(theme -> new ResponseDTO<>(HttpStatus.OK, theme)); } @JsonView(Views.Public.class) @@ -51,13 +51,12 @@ public Mono> getCurrentTheme( public Mono> updateTheme( @PathVariable String branchedApplicationId, @Valid @RequestBody Theme resource) { return service.updateTheme(branchedApplicationId, resource) - .map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null)); + .map(theme -> new ResponseDTO<>(HttpStatus.OK, theme)); } @JsonView(Views.Public.class) @PatchMapping("{themeId}") public Mono> updateName(@PathVariable String themeId, @Valid @RequestBody Theme resource) { - return service.updateName(themeId, resource) - .map(theme -> new ResponseDTO<>(HttpStatus.OK.value(), theme, null)); + return service.updateName(themeId, resource).map(theme -> new ResponseDTO<>(HttpStatus.OK, theme)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UsagePulseControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UsagePulseControllerCE.java index 3c82234eba7e..4539bebe1d25 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UsagePulseControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UsagePulseControllerCE.java @@ -25,6 +25,6 @@ public class UsagePulseControllerCE { @PostMapping @ResponseStatus(HttpStatus.CREATED) public Mono> create(@RequestBody @Valid UsagePulseDTO usagePulseDTO) { - return service.createPulse(usagePulseDTO).thenReturn(new ResponseDTO<>(HttpStatus.CREATED.value(), true, null)); + return service.createPulse(usagePulseDTO).thenReturn(new ResponseDTO<>(HttpStatus.CREATED, true)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java index b7813b5505bb..dc4ef7cf5913 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java @@ -72,15 +72,13 @@ public Mono createSuperUserFromFormData( @PutMapping() public Mono> update(@RequestBody UserUpdateDTO updates, ServerWebExchange exchange) { return service.updateCurrentUser(updates, exchange) - .map(updatedUser -> new ResponseDTO<>(HttpStatus.OK.value(), updatedUser, null)); + .map(updatedUser -> new ResponseDTO<>(HttpStatus.OK, updatedUser)); } @JsonView(Views.Public.class) @PutMapping("/leaveWorkspace/{workspaceId}") public Mono> leaveWorkspace(@PathVariable String workspaceId) { - return userWorkspaceService - .leaveWorkspace(workspaceId) - .map(user -> new ResponseDTO<>(HttpStatus.OK.value(), user, null)); + return userWorkspaceService.leaveWorkspace(workspaceId).map(user -> new ResponseDTO<>(HttpStatus.OK, user)); } /** @@ -98,14 +96,13 @@ public Mono> forgotPasswordRequest( return service.forgotPasswordTokenGenerate(userPasswordDTO) .defaultIfEmpty(true) .onErrorReturn(true) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), true, null)); + .thenReturn(new ResponseDTO<>(HttpStatus.OK, true)); } @JsonView(Views.Public.class) @GetMapping("/verifyPasswordResetToken") public Mono> verifyPasswordResetToken(@RequestParam String token) { - return service.verifyPasswordResetToken(token) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + return service.verifyPasswordResetToken(token).map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -113,14 +110,13 @@ public Mono> verifyPasswordResetToken(@RequestParam String public Mono> resetPasswordAfterForgotPassword( @RequestBody ResetUserPasswordDTO userPasswordDTO) { return service.resetPasswordAfterForgotPassword(userPasswordDTO.getToken(), userPasswordDTO) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @GetMapping("/me") public Mono> getUserProfile(@AuthenticationPrincipal User user) { - return service.buildUserProfileDTO(user) - .map(profile -> new ResponseDTO<>(HttpStatus.OK.value(), profile, null)); + return service.buildUserProfileDTO(user).map(profile -> new ResponseDTO<>(HttpStatus.OK, profile)); } /** @@ -139,7 +135,7 @@ public Mono>> inviteUsers( @RequestParam(required = false) String recaptchaToken) { return userAndAccessManagementService .inviteUsers(inviteUsersDTO, originHeader, recaptchaToken) - .map(users -> new ResponseDTO<>(HttpStatus.OK.value(), users, null)); + .map(users -> new ResponseDTO<>(HttpStatus.OK, users)); } @JsonView(Views.Public.class) @@ -148,20 +144,19 @@ public Mono> setReleaseNotesViewed() { return sessionUserService .getCurrentUser() .flatMap(userDataService::setViewedCurrentVersionReleaseNotes) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), null, null)); + .thenReturn(new ResponseDTO<>(HttpStatus.OK, null)); } @JsonView(Views.Public.class) @PostMapping(value = "/photo", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public Mono> uploadProfilePhoto(@RequestPart("file") Mono fileMono) { - return fileMono.flatMap(userDataService::saveProfilePhoto) - .map(url -> new ResponseDTO<>(HttpStatus.OK.value(), url, null)); + return fileMono.flatMap(userDataService::saveProfilePhoto).map(url -> new ResponseDTO<>(HttpStatus.OK, url)); } @JsonView(Views.Public.class) @DeleteMapping("/photo") public Mono> deleteProfilePhoto() { - return userDataService.deleteProfilePhoto().thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), null, null)); + return userDataService.deleteProfilePhoto().thenReturn(new ResponseDTO<>(HttpStatus.OK, null)); } @JsonView(Views.Public.class) @@ -183,9 +178,7 @@ public Mono getProfilePhoto(ServerWebExchange exchange, @PathVariable Stri @JsonView(Views.Public.class) @GetMapping("/features") public Mono>> getFeatureFlags() { - return userDataService - .getFeatureFlagsForCurrentUser() - .map(map -> new ResponseDTO<>(HttpStatus.OK.value(), map, null)); + return userDataService.getFeatureFlagsForCurrentUser().map(map -> new ResponseDTO<>(HttpStatus.OK, map)); } /** @@ -199,7 +192,7 @@ public Mono> resendEmailVerification( @RequestHeader("Origin") String originHeader) { resendEmailVerificationDTO.setBaseUrl(originHeader); return service.resendEmailVerification(resendEmailVerificationDTO, null) - .thenReturn(new ResponseDTO<>(HttpStatus.OK.value(), true, null)); + .thenReturn(new ResponseDTO<>(HttpStatus.OK, true)); } /** diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java index f8ae8565e8db..a2a3688a80a4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java @@ -37,28 +37,26 @@ public class WorkspaceControllerCE { @JsonView(Views.Public.class) @GetMapping("/{id}") public Mono> getById(@PathVariable String id) { - return service.getById(id).map(workspace -> new ResponseDTO<>(HttpStatus.OK.value(), workspace, null)); + return service.getById(id).map(workspace -> new ResponseDTO<>(HttpStatus.OK, workspace)); } @JsonView(Views.Public.class) @PostMapping @ResponseStatus(HttpStatus.CREATED) public Mono> create(@Valid @RequestBody Workspace resource) { - return service.create(resource).map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + return service.create(resource).map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @PutMapping("/{id}") public Mono> update(@PathVariable String id, @RequestBody Workspace resource) { - return service.update(id, resource) - .map(updatedResource -> new ResponseDTO<>(HttpStatus.OK.value(), updatedResource, null)); + return service.update(id, resource).map(updatedResource -> new ResponseDTO<>(HttpStatus.OK, updatedResource)); } @JsonView(Views.Public.class) @DeleteMapping("/{id}") public Mono> delete(@PathVariable String id) { - return service.archiveById(id) - .map(deletedResource -> new ResponseDTO<>(HttpStatus.OK.value(), deletedResource, null)); + return service.archiveById(id).map(deletedResource -> new ResponseDTO<>(HttpStatus.OK, deletedResource)); } /** @@ -69,7 +67,7 @@ public Mono> delete(@PathVariable String id) { public Mono>> getPermissionGroupsForWorkspace( @PathVariable String workspaceId) { return service.getPermissionGroupsForWorkspace(workspaceId) - .map(groupInfoList -> new ResponseDTO<>(HttpStatus.OK.value(), groupInfoList, null)); + .map(groupInfoList -> new ResponseDTO<>(HttpStatus.OK, groupInfoList)); } @JsonView(Views.Public.class) @@ -77,7 +75,7 @@ public Mono>> getPermissionGroupsForWor public Mono>> getUserMembersOfWorkspace(@PathVariable String workspaceId) { return userWorkspaceService .getWorkspaceMembers(workspaceId) - .map(users -> new ResponseDTO<>(HttpStatus.OK.value(), users, null)); + .map(users -> new ResponseDTO<>(HttpStatus.OK, users)); } @JsonView(Views.Public.class) @@ -88,7 +86,7 @@ public Mono> updatePermissionGroupForMember( @RequestHeader(name = "Origin", required = false) String originHeader) { return userWorkspaceService .updatePermissionGroupForMember(workspaceId, updatePermissionGroupDTO, originHeader) - .map(user -> new ResponseDTO<>(HttpStatus.OK.value(), user, null)); + .map(user -> new ResponseDTO<>(HttpStatus.OK, user)); } @JsonView(Views.Public.class) @@ -96,14 +94,13 @@ public Mono> updatePermissionGroupForMember( public Mono> uploadLogo( @PathVariable String workspaceId, @RequestPart("file") Mono fileMono) { return fileMono.flatMap(filePart -> service.uploadLogo(workspaceId, filePart)) - .map(url -> new ResponseDTO<>(HttpStatus.OK.value(), url, null)); + .map(url -> new ResponseDTO<>(HttpStatus.OK, url)); } @JsonView(Views.Public.class) @DeleteMapping("/{workspaceId}/logo") public Mono> deleteLogo(@PathVariable String workspaceId) { - return service.deleteLogo(workspaceId) - .map(workspace -> new ResponseDTO<>(HttpStatus.OK.value(), workspace, null)); + return service.deleteLogo(workspaceId).map(workspace -> new ResponseDTO<>(HttpStatus.OK, workspace)); } @JsonView(Views.Public.class) @@ -112,6 +109,6 @@ public Mono>> workspacesForHome( @RequestHeader(name = "Host", required = false) String hostname) { return userWorkspaceService .getUserWorkspacesByRecentlyUsedOrder(hostname) - .map(workspaces -> new ResponseDTO<>(HttpStatus.OK.value(), workspaces, null)); + .map(workspaces -> new ResponseDTO<>(HttpStatus.OK, workspaces)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ResponseDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ResponseDTO.java index 85a701b6ce0f..65fad132938e 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ResponseDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/ResponseDTO.java @@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; +import org.springframework.http.HttpStatus; import java.io.Serializable; @@ -22,6 +23,10 @@ public class ResponseDTO implements Serializable { private T data; + public ResponseDTO(HttpStatus status, T data) { + this(status.value(), data, null); + } + public ResponseDTO(int status, T data, String message) { this.responseMeta = new ResponseMetaDTO(status, message); this.data = data; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitApplicationControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitApplicationControllerCE.java index a631781b9bae..eb536229e1bb 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitApplicationControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitApplicationControllerCE.java @@ -61,7 +61,7 @@ public class GitApplicationControllerCE { public Mono> getGitMetadata(@PathVariable String baseApplicationId) { return centralGitService .getGitArtifactMetadata(baseApplicationId, ARTIFACT_TYPE) - .map(metadata -> new ResponseDTO<>(HttpStatus.OK.value(), metadata, null)); + .map(metadata -> new ResponseDTO<>(HttpStatus.OK, metadata)); } @JsonView(Views.Public.class) @@ -72,7 +72,7 @@ public Mono> connectApplicationToRemoteRepo( @RequestHeader("Origin") String originHeader) { return centralGitService .connectArtifactToGit(applicationId, ARTIFACT_TYPE, gitConnectDTO, originHeader, GIT_TYPE) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -83,7 +83,7 @@ public Mono> commit( log.info("Going to commit branchedApplicationId {}", branchedApplicationId); return centralGitService .commitArtifact(commitDTO, branchedApplicationId, ARTIFACT_TYPE, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -99,7 +99,7 @@ public Mono> createReference( srcBranch); return centralGitService .createReference(referencedApplicationId, ARTIFACT_TYPE, gitRefDTO, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @@ -108,7 +108,7 @@ public Mono> checkoutReference( @PathVariable String referencedApplicationId, @RequestBody GitRefDTO gitRefDTO) { return centralGitService .checkoutReference(referencedApplicationId, ARTIFACT_TYPE, gitRefDTO, true, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -117,7 +117,7 @@ public Mono> disconnectFromRemote(@PathVariable log.info("Going to remove the remoteUrl for application {}", branchedApplicationId); return centralGitService .detachRemote(branchedApplicationId, ARTIFACT_TYPE, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -126,7 +126,7 @@ public Mono> pull(@PathVariable String branchedApplicati log.info("Going to pull the latest for branchedApplicationId {}", branchedApplicationId); return centralGitService .pullArtifact(branchedApplicationId, ARTIFACT_TYPE, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -137,7 +137,7 @@ public Mono> getStatus( log.info("Going to get status for branchedApplicationId {}", branchedApplicationId); return centralGitService .getStatus(branchedApplicationId, ARTIFACT_TYPE, compareRemote, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -148,7 +148,7 @@ public Mono> fetchRemoteChanges( log.info("Going to compare with remote for default referencedApplicationId {}", referencedApplicationId); return centralGitService .fetchRemoteChanges(referencedApplicationId, ARTIFACT_TYPE, true, GIT_TYPE, refType) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -162,7 +162,7 @@ public Mono> merge( branchedApplicationId); return centralGitService .mergeBranch(branchedApplicationId, ARTIFACT_TYPE, gitMergeDTO, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -176,7 +176,7 @@ public Mono> mergeStatus( branchedApplicationId); return centralGitService .isBranchMergable(branchedApplicationId, ARTIFACT_TYPE, gitMergeDTO, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -188,7 +188,7 @@ public Mono> deleteBranch( log.info("Going to delete ref {} for baseApplicationId {}", refName, baseArtifactId); return centralGitService .deleteGitReference(baseArtifactId, ARTIFACT_TYPE, refName, refType, GIT_TYPE) - .map(application -> new ResponseDTO<>(HttpStatus.OK.value(), application, null)); + .map(application -> new ResponseDTO<>(HttpStatus.OK, application)); } @JsonView(Views.Public.class) @@ -197,7 +197,7 @@ public Mono> discardChanges(@PathVariable String log.info("Going to discard changes for branchedApplicationId {}", branchedApplicationId); return centralGitService .discardChanges(branchedApplicationId, ARTIFACT_TYPE, GIT_TYPE) - .map(result -> new ResponseDTO<>((HttpStatus.OK.value()), result, null)); + .map(result -> new ResponseDTO<>((HttpStatus.OK), result)); } @JsonView(Views.Public.class) @@ -207,7 +207,7 @@ public Mono>> updateProtectedBranches( @RequestBody @Valid BranchProtectionRequestDTO branchProtectionRequestDTO) { return centralGitService .updateProtectedBranches(baseArtifactId, ARTIFACT_TYPE, branchProtectionRequestDTO.getBranchNames()) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @@ -215,7 +215,7 @@ public Mono>> updateProtectedBranches( public Mono>> getProtectedBranches(@PathVariable String baseArtifactId) { return centralGitService .getProtectedBranches(baseArtifactId, ARTIFACT_TYPE) - .map(list -> new ResponseDTO<>(HttpStatus.OK.value(), list, null)); + .map(list -> new ResponseDTO<>(HttpStatus.OK, list)); } @JsonView(Views.Public.class) @@ -223,7 +223,7 @@ public Mono>> getProtectedBranches(@PathVariable String public Mono> autoCommitApplication(@PathVariable String branchedApplicationId) { return autoCommitService .autoCommitApplication(branchedApplicationId) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @@ -233,7 +233,7 @@ public Mono> getAutoCommitProgress( @RequestHeader(name = FieldName.BRANCH_NAME, required = false) String branchName) { return centralGitService .getAutoCommitProgress(baseApplicationId, ARTIFACT_TYPE, branchName) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @@ -241,7 +241,7 @@ public Mono> getAutoCommitProgress( public Mono> toggleAutoCommitEnabled(@PathVariable String baseArtifactId) { return centralGitService .toggleAutoCommitEnabled(baseArtifactId, ARTIFACT_TYPE) - .map(data -> new ResponseDTO<>(HttpStatus.OK.value(), data, null)); + .map(data -> new ResponseDTO<>(HttpStatus.OK, data)); } @JsonView(Views.Public.class) @@ -254,7 +254,7 @@ public Mono>> getReferences( return centralGitService .listBranchForArtifact( branchedApplicationId, ARTIFACT_TYPE, BooleanUtils.isTrue(pruneBranches), GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } @JsonView(Views.Public.class) @@ -262,7 +262,7 @@ public Mono>> getReferences( public Mono> getSSHKey(@PathVariable String branchedApplicationId) { return artifactService .getSshKey(ARTIFACT_TYPE, branchedApplicationId) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } @JsonView(Views.Public.class) @@ -271,6 +271,6 @@ public Mono> generateSSHKeyPair( @PathVariable String branchedApplicationId, @RequestParam(required = false) String keyType) { return artifactService .createOrUpdateSshKeyPair(ARTIFACT_TYPE, branchedApplicationId, keyType) - .map(created -> new ResponseDTO<>(HttpStatus.CREATED.value(), created, null)); + .map(created -> new ResponseDTO<>(HttpStatus.CREATED, created)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitArtifactControllerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitArtifactControllerCE.java index 785fffa64ea3..377c3976b016 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitArtifactControllerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitArtifactControllerCE.java @@ -51,7 +51,7 @@ public Mono>> saveGitProfile(@RequestBody Gi log.debug("Going to add default git profile for user"); return gitProfileUtils .updateOrCreateGitProfileForCurrentUser(gitProfile) - .map(response -> new ResponseDTO<>(HttpStatus.OK.value(), response, null)); + .map(response -> new ResponseDTO<>(HttpStatus.OK, response)); } @JsonView(Views.Public.class) @@ -59,7 +59,7 @@ public Mono>> saveGitProfile(@RequestBody Gi public Mono> getDefaultGitConfigForUser() { return gitProfileUtils .getDefaultGitProfileOrCreateIfEmpty() - .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK.value(), gitConfigResponse, null)); + .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK, gitConfigResponse)); } @JsonView(Views.Public.class) @@ -69,7 +69,7 @@ public Mono>> saveGitProfile( log.debug("Going to add repo specific git profile for application: {}", baseApplicationId); return gitProfileUtils .updateOrCreateGitProfileForCurrentUser(gitProfile, baseApplicationId) - .map(response -> new ResponseDTO<>(HttpStatus.ACCEPTED.value(), response, null)); + .map(response -> new ResponseDTO<>(HttpStatus.ACCEPTED, response)); } @JsonView(Views.Public.class) @@ -77,7 +77,7 @@ public Mono>> saveGitProfile( public Mono> getGitConfigForUser(@PathVariable String baseArtifactId) { return gitProfileUtils .getGitProfileForUser(baseArtifactId) - .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK.value(), gitConfigResponse, null)); + .map(gitConfigResponse -> new ResponseDTO<>(HttpStatus.OK, gitConfigResponse)); } @JsonView(Views.Public.class) @@ -88,15 +88,13 @@ public Mono> importArtifactFromGit( // TODO: remove artifact type from methods. return centralGitService .importArtifactFromGit(workspaceId, gitConnectDTO, GIT_TYPE) - .map(result -> new ResponseDTO<>(HttpStatus.CREATED.value(), result, null)); + .map(result -> new ResponseDTO<>(HttpStatus.CREATED, result)); } @JsonView(Views.Public.class) @GetMapping("/doc-urls") public Mono>> getGitDocs() { - return centralGitService - .getGitDocUrls() - .map(gitDocDTO -> new ResponseDTO<>(HttpStatus.OK.value(), gitDocDTO, null)); + return centralGitService.getGitDocUrls().map(gitDocDTO -> new ResponseDTO<>(HttpStatus.OK, gitDocDTO)); } @JsonView(Views.Public.class) @@ -104,14 +102,12 @@ public Mono>> getGitDocs() { public Mono>> getSupportedKeys() { log.info("Going to list the list of supported keys"); return Mono.just(GitDeployKeyGenerator.getSupportedProtocols()) - .map(gitDeployKeyDTOS -> new ResponseDTO<>(HttpStatus.OK.value(), gitDeployKeyDTOS, null)); + .map(gitDeployKeyDTOS -> new ResponseDTO<>(HttpStatus.OK, gitDeployKeyDTOS)); } @JsonView(Views.Public.class) @GetMapping("/import/keys") public Mono> generateKeyForGitImport(@RequestParam(required = false) String keyType) { - return centralGitService - .generateSSHKey(keyType) - .map(result -> new ResponseDTO<>(HttpStatus.OK.value(), result, null)); + return centralGitService.generateSSHKey(keyType).map(result -> new ResponseDTO<>(HttpStatus.OK, result)); } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java index a4702cfef355..4f2e12d7e51a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java @@ -121,7 +121,7 @@ public class ConsolidatedAPIServiceCEImpl implements ConsolidatedAPIServiceCE { private final ObservationHelper observationHelper; protected ResponseDTO getSuccessResponse(T data) { - return new ResponseDTO<>(HttpStatus.OK.value(), data, null); + return new ResponseDTO<>(HttpStatus.OK, data); } protected Mono> getErrorResponseMono(Throwable error) {