Skip to content

Commit

Permalink
Docs : change update behaviour
Browse files Browse the repository at this point in the history
update the update() behaviour where we check if the new value is not null and then we set it.
  • Loading branch information
Mr-AXEL01 committed Dec 31, 2024
1 parent 1ce11cc commit 2783d4d
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,18 @@ public SurveyResponseDTO create(SurveyRequestDTO dto) {

@Override
protected void updateEntity(Survey survey, SurveyRequestDTO dto) {
survey.setTitle(dto.title())
.setDescription(dto.description())
.setOwner(owner(dto.ownerId()));
if (dto.title() != null) {
survey.setTitle(dto.title());
}

if (dto.description() != null) {
survey.setDescription(dto.description());
}

if (dto.ownerId() != null) {
survey.setOwner(owner(dto.ownerId()));
}

}

private Owner owner(UUID ownerId) {
Expand Down

0 comments on commit 2783d4d

Please sign in to comment.