-
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
fix: improve manytoone relations in db (no link tables) #98
base: develop
Are you sure you want to change the base?
Conversation
DROP TABLE public.campaign_partitionings; DROP TABLE public.contact_contact_events; DROP TABLE public.internal_users_user_events; DROP TABLE public.operator_service_operators; DROP TABLE public.questioning_questioning_accreditations; DROP TABLE public.questioning_questioning_comments; DROP TABLE public.questioning_questioning_communications; DROP TABLE public.questioning_questioning_events; DROP TABLE public.source_source_accreditations; DROP TABLE public.source_surveys; DROP TABLE public.survey_campaigns; DROP TABLE public.survey_unit_questionings; DROP TABLE public.survey_unit_survey_unit_comments; CREATE INDEX idx_contact_fullname_upper |
|
||
return updateContactAddressEvent(contact, payload); | ||
|
||
} else { |
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.
else antipattern ;)
newContact.setAddress(addressService.convertToEntity(contactDto.getAddress())); | ||
} | ||
|
||
Contact createdContact = createContactAddressEvent(newContact, payload); |
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.
createContactAddressEvent creates a contact, but the method name indicates we create an address event
Contact createdContact = createContactAddressEvent(newContact, payload); | ||
|
||
// Créer une vue pour le nouveau contact | ||
viewService.createView(id, null, null); |
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.
refactoring name to understand we're talking about contacts ? Why not using a real view instead of a table ?
@@ -32,35 +31,14 @@ public Owner insertOrUpdateOwner(Owner owner) { | |||
|
|||
try { | |||
Owner ownerBase = findById(owner.getId()); |
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.
findById could return an Optional, you won't need the try/catch in this case. The save method could be after the try/catch
pageQuestionings = questioningRepository.findBySurveyUnitIdSuOrSurveyUnitIdentificationCodeOrQuestioningAccreditationsIdContact(param, param, param, pageable); | ||
List<Questioning> listQuestionings = questioningRepository.findQuestioningByParam(param.toUpperCase()); | ||
List<SearchQuestioningDto> searchDtos = listQuestionings | ||
.stream().distinct() |
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 distinct could be in the sql query ?
.stream().distinct() | ||
.map(this::convertToSearchDto).toList(); | ||
|
||
return new PageImpl<>(searchDtos, pageable, searchDtos.size()); | ||
} else { |
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.
else anti pattern
could be great to create migration scripts for database |
Quality Gate passedIssues Measures |
No description provided.