-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat search questioning #91
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bebb485
feat: add get list questionings and first search version
BettyB979 ee27990
fix: tests
BettyB979 6bd4977
feat: add get questioning Details
BettyB979 3076178
fix: add campaign to endpoint questioning dto
BettyB979 329af82
feat: add questioning comment
BettyB979 a9d9eb1
Merge branch 'develop' into feat_search_questioning
BettyB979 5417bec
fix: tests
BettyB979 c789c8b
fix: compilation questioningServiceImpl
BettyB979 59bf15f
fix: get last communication and add test
BettyB979 67cd7db
build: version 2.7.0
BettyB979 d8dfbb8
build: trivy 0.28.0
BettyB979 a62a5ee
fix: controller dto
BettyB979 b3e0793
fix:: avoid GHCR rate limits for trivy analysis
BettyB979 0a50065
Merge branch 'develop' into feat_search_questioning
BettyB979 46f1aea
fix: add survey unit name and label
BettyB979 ae68409
Merge branch 'develop' into feat_search_questioning
BettyB979 7111768
feat: update doc mdd
BettyB979 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ jobs: | |
distribution: 'temurin' | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/[email protected] | ||
env: | ||
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 | ||
with: | ||
format: 'table' | ||
scan-type: 'repo' | ||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
54 changes: 54 additions & 0 deletions
54
...r/insee/survey/datacollectionmanagement/query/controller/SearchQuestioningController.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,54 @@ | ||
package fr.insee.survey.datacollectionmanagement.query.controller; | ||
|
||
import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges; | ||
import fr.insee.survey.datacollectionmanagement.constants.Constants; | ||
import fr.insee.survey.datacollectionmanagement.query.dto.QuestioningDetailsDto; | ||
import fr.insee.survey.datacollectionmanagement.query.dto.SearchQuestioningDto; | ||
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES) | ||
@Slf4j | ||
@Tag(name = "2 - Questioning", description = "Enpoints to create, update, delete and find entities around the questionings") | ||
@RequiredArgsConstructor | ||
public class SearchQuestioningController { | ||
|
||
private final QuestioningService questioningService; | ||
|
||
@Operation(summary = "Multi-criteria search questionings") | ||
@GetMapping(value = Constants.API_QUESTIONINGS_SEARCH, produces = "application/json") | ||
public Page<SearchQuestioningDto> searchQuestionings( | ||
@RequestParam(required = false) String searchParam, | ||
@RequestParam(defaultValue = "0") Integer page, | ||
@RequestParam(defaultValue = "20") Integer pageSize) { | ||
log.info( | ||
"Search questionings with param {} page = {} pageSize = {}", searchParam, page, pageSize); | ||
|
||
Pageable pageable = PageRequest.of(page, pageSize); | ||
|
||
return questioningService.searchQuestioning(searchParam, pageable); | ||
|
||
} | ||
|
||
@Operation(summary = "Get questioning details") | ||
@GetMapping(value = Constants.API_QUESTIONINGS_ID, produces = "application/json") | ||
public QuestioningDetailsDto getQuestioning (@PathVariable("id") Long id) { | ||
|
||
return questioningService.getQuestioningDetails(id); | ||
|
||
} | ||
|
||
|
||
} |
67 changes: 67 additions & 0 deletions
67
.../survey/datacollectionmanagement/questioning/controller/QuestioningCommentController.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,67 @@ | ||
package fr.insee.survey.datacollectionmanagement.questioning.controller; | ||
|
||
import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges; | ||
import fr.insee.survey.datacollectionmanagement.constants.Constants; | ||
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning; | ||
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningComment; | ||
import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentInputDto; | ||
import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentOutputDto; | ||
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningCommentService; | ||
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.modelmapper.ModelMapper; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.Date; | ||
import java.util.Set; | ||
|
||
@RestController | ||
@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES) | ||
@Tag(name = "2 - Questioning", description = "Enpoints to create, update, delete and find entities around the questionings") | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@Validated | ||
public class QuestioningCommentController { | ||
|
||
private final QuestioningService questioningService; | ||
private final QuestioningCommentService questioningCommentService; | ||
private final ModelMapper modelMapper; | ||
|
||
|
||
@Operation(summary = "Create a questioning comment") | ||
@PostMapping(value = Constants.API_QUESTIONING_ID_COMMENT, produces = "application/json", consumes = "application/json") | ||
@ResponseStatus(HttpStatus.CREATED) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = QuestioningCommentInputDto.class))), | ||
@ApiResponse(responseCode = "400", description = "Bad request"), | ||
@ApiResponse(responseCode = "404", description = "Not found") | ||
}) | ||
public QuestioningCommentOutputDto postQuestioningComment(@PathVariable Long id, @Valid @RequestBody QuestioningCommentInputDto questioningCommentDto) { | ||
|
||
Questioning questioning = questioningService.findbyId(id); | ||
QuestioningComment questioningComment = questioningCommentService.convertToEntity(questioningCommentDto); | ||
questioningComment.setDate(new Date()); | ||
QuestioningComment newQuestioningComment = questioningCommentService.saveQuestioningComment(questioningComment); | ||
Set<QuestioningComment> setQuestioningComments = questioning.getQuestioningComments(); | ||
setQuestioningComments.add(newQuestioningComment); | ||
questioning.setQuestioningComments(setQuestioningComments); | ||
questioningService.saveQuestioning(questioning); | ||
return questioningCommentService.convertToOutputDto(newQuestioningComment); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
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
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
20 changes: 20 additions & 0 deletions
20
.../java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningComment.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,20 @@ | ||
package fr.insee.survey.datacollectionmanagement.questioning.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Date; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
public class QuestioningComment { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "quest_comment_seq") | ||
private Long id; | ||
@Column(length = 2000) | ||
private String comment; | ||
private String author; | ||
private Date date; | ||
} |
8 changes: 8 additions & 0 deletions
8
.../survey/datacollectionmanagement/questioning/repository/QuestioningCommentRepository.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,8 @@ | ||
package fr.insee.survey.datacollectionmanagement.questioning.repository; | ||
|
||
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningComment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface QuestioningCommentRepository extends JpaRepository<QuestioningComment, Long> { | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe the service which converts to entity ? controller only needs to control input data