-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat searchsurveys campaignspartitioningsbysurvey endpoints (#50)
* feat - add get campaigns and partitionings by survey id * feat - add search surveys endpoints * fix - integrate pr review modifs --------- Co-authored-by: Eric Thuaud <eric.thuaud@insee.fr>
- Loading branch information
1 parent
3aca094
commit 4cd4d27
Showing
8 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
.../java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package fr.insee.survey.datacollectionmanagement.metadata.dto; | ||
|
||
import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
public class CampaignPartitioningsDto { | ||
|
||
@NotBlank | ||
private String id; | ||
private String surveyId; | ||
private int year; | ||
private String campaignWording; | ||
private PeriodEnum period; | ||
private List<PartitioningDto> partitionings; | ||
} |
23 changes: 19 additions & 4 deletions
23
...n/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SurveyRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
package fr.insee.survey.datacollectionmanagement.metadata.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
|
||
import fr.insee.survey.datacollectionmanagement.metadata.domain.Survey; | ||
|
||
public interface SurveyRepository extends JpaRepository<Survey, String>, PagingAndSortingRepository<Survey, String> { | ||
|
||
List<Survey> findByYear(int year); | ||
|
||
static final String QUERY_FIND_SURVEY = | ||
""" | ||
select | ||
su.* | ||
from | ||
survey su | ||
join source so | ||
on (so.id=su.source_id) | ||
where | ||
(:sourceId is null or UPPER(su.source_id) = UPPER(cast( :sourceId as text))) | ||
and (:periodicity is null or UPPER(so.periodicity) = UPPER(cast( :periodicity as text))) | ||
and (:year is null or su.year_value = :year) | ||
"""; | ||
@Query(nativeQuery = true, value = QUERY_FIND_SURVEY) | ||
Page<Survey> findBySourceIdYearPeriodicity(Pageable pageable, String sourceId, Integer year, String periodicity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters