From 005a4a647f72b564b2e2c047aa11d5662f5c3f7b Mon Sep 17 00:00:00 2001 From: Betty Becuwe Date: Fri, 6 Dec 2024 14:58:32 +0100 Subject: [PATCH] fix: remove sort in search endpoints --- .../contact/controller/ContactController.java | 5 ++--- .../questioning/controller/SurveyUnitController.java | 5 ++--- .../questioning/domain/SurveyUnit.java | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java index ab93f56..d239c20 100644 --- a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java +++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java @@ -145,13 +145,12 @@ public Page searchContacts( @RequestParam(required = true) String searchParam, @RequestParam(required = false) @Valid @ValidContactParam String searchType, @RequestParam(defaultValue = "0") Integer page, - @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(defaultValue = "identifier") String sort) { + @RequestParam(defaultValue = "10") Integer pageSize) { log.info( "Search contact by {} with param = {} page = {} pageSize = {}", searchType, searchParam, page, pageSize); - Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort)); + Pageable pageable = PageRequest.of(page, pageSize); switch (ContactParamEnum.fromValue(searchType)) { case ContactParamEnum.IDENTIFIER: diff --git a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java index 106c23f..cc7cb9b 100644 --- a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java +++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java @@ -77,12 +77,11 @@ public Page searchSurveyUnits( @RequestParam(required = true) String searchParam, @RequestParam(required = true) @Valid @ValidSurveyUnitParam @Schema(description = "id or code or name")String searchType, @RequestParam(defaultValue = "0") Integer page, - @RequestParam(defaultValue = "20") Integer pageSize, - @RequestParam(defaultValue = "id_su") String sort) { + @RequestParam(defaultValue = "20") Integer pageSize) { log.info( "Search surveyUnit by {} with param = {} page = {} pageSize = {}", searchType, searchParam, page, pageSize); - Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort)); + Pageable pageable = PageRequest.of(page, pageSize); return switch (SurveyUnitParamEnum.fromValue(searchType)) { case SurveyUnitParamEnum.IDENTIFIER -> surveyUnitService.findbyIdentifier(searchParam, pageable); diff --git a/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java index 4a4dfdf..d93316b 100644 --- a/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java +++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java @@ -30,7 +30,7 @@ public class SurveyUnit { private String label; - @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) private SurveyUnitAddress surveyUnitAddress; @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "surveyUnit" )