-
Notifications
You must be signed in to change notification settings - Fork 2
Add contact persons use case #80
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
base: dev
Are you sure you want to change the base?
Add contact persons use case #80
Conversation
Summary of ChangesHello @KarlsonComplete, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new 'Contact Persons' domain into the application, providing a structured and robust way to manage individual contact information. It establishes a comprehensive data model for contact persons, complete with lifecycle management (creation, updates, deletion, status changes, verification) and integrates it with the existing application installation logic. The changes are supported by new Doctrine mappings, dedicated repositories, and a set of well-defined use cases, ensuring maintainability and testability. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a significant new feature, the "Contact Persons" use case, including entities, repositories, use cases, and tests. The overall structure is good and follows the existing architecture. However, I've found several issues related to correctness, consistency, and robustness that need to be addressed. These include potential null pointer exceptions, inconsistent behavior in entities, bugs in repositories and handlers, and some issues in the new tests. Please review the detailed comments below.
src/ContactPersons/Infrastructure/Doctrine/ContactPersonRepository.php
Outdated
Show resolved
Hide resolved
src/ContactPersons/Infrastructure/Doctrine/ContactPersonRepository.php
Outdated
Show resolved
Hide resolved
| 'contactPersonId' => $command->contactPersonId->toRfc4122(), | ||
| ]); | ||
|
|
||
| /** @var null|AggregateRootEventsEmitterInterface|ContactPersonInterface $contactPerson */ |
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.
Тут надо обрабатывать исключение, так как на момент верификации почты у тебя контактное лицо может быть уже удалено.
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.
У тебя контакное лицо связано с установкой
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.
Вопрос, что если почта уже подтверждена? =)))
camaxtly
left a comment
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.
14-12-2025
| 'contactPersonId' => $command->contactPersonId->toRfc4122(), | ||
| ]); | ||
|
|
||
| /** @var null|AggregateRootEventsEmitterInterface|ContactPersonInterface $contactPerson */ |
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.
У тебя контакное лицо связано с установкой
| 'contactPersonId' => $command->contactPersonId->toRfc4122(), | ||
| ]); | ||
|
|
||
| /** @var null|AggregateRootEventsEmitterInterface|ContactPersonInterface $contactPerson */ |
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.
Вопрос, что если почта уже подтверждена? =)))
camaxtly
left a comment
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.
04-01-2026
… and update tests for consistency.
…, streamline contact person operations, and update tests accordingly.
…atus and timestamps
| public function unlinkContactPerson(): void | ||
| { | ||
| $this->updatedAt = new CarbonImmutable(); | ||
| if (!$this->contactPersonId instanceof Uuid) { |
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.
is 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.
заменил но ректор показывает ошибку
| public function unlinkBitrix24PartnerContactPerson(): void | ||
| { | ||
| $this->updatedAt = new CarbonImmutable(); | ||
| if (!$this->bitrix24PartnerContactPersonId instanceof Uuid) { |
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.
is 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.
заменил но ректор показывает ошибку
src/ApplicationInstallations/UseCase/UnlinkContactPerson/Handler.php
Outdated
Show resolved
Hide resolved
src/ApplicationInstallations/UseCase/UnlinkContactPerson/Handler.php
Outdated
Show resolved
Hide resolved
src/ContactPersons/UseCase/MarkMobilePhoneAsVerified/Handler.php
Outdated
Show resolved
Hide resolved
camaxtly
left a comment
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.
11-01-2026
…tion ID, handle exceptions, and improve logging
…s, streamline method calls, and update test implementations for consistency.
…` and `unlinkBitrix24PartnerContactPerson` methods.
| $createdContactPersonId = ''; | ||
|
|
||
| try { | ||
| if ($command->mobilePhoneNumber instanceof PhoneNumber) { |
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.
Тут IF используется не корректно. Тебе надо проверить, а пришли ли данные для создания контактного лица, если пришли, то мы его создаем, если не пришли, то установка приложения проджолжается без контактного лица.
В ветке, когда создается контактное лицо можно использовать guard*, чтоб проверить входящие данные и если что-то не так, то мы прерываем работу этого хэндлера, но сам флоу установки должен пройти дальше.
| $applicationInstallation = $this->applicationInstallationRepository->getById($command->applicationInstallationId); | ||
|
|
||
| $entitiesToFlush = []; | ||
| if ($contactPerson->isPartner()) { |
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.
if ($contactPerson->isPartner()) {
$applicationInstallation->unlinkBitrix24PartnerContactPerson();
} else {
$applicationInstallation->unlinkContactPerson();
}
$this->applicationInstallationRepository->save($applicationInstallation);
$entitiesToFlush[] = $applicationInstallation;
| $contactPerson = $this->contactPersonRepository->getById($command->contactPersonId); | ||
|
|
||
| $actualEmail = $contactPerson->getEmail(); | ||
| if (null == $actualEmail) { |
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.
избыточно, так как мы передаем в команду ту почту, которую верифицировали
| $contactPerson = $this->contactPersonRepository->getById($command->contactPersonId); | ||
|
|
||
| $actualPhone = $contactPerson->getMobilePhone(); | ||
| if (null == $actualPhone) { |
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.
избыточно
camaxtly
left a comment
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.
18-01-2026
.