Add Journal entity support with PSR-3 compatibility#83
Conversation
…and `countByApplicationInstallationId`
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 refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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.
Code Review
This pull request refactors the DoctrineDbalJournalItemRepository to use composition over inheritance for the EntityRepository, which is a good practice for better maintainability and testability. It also removes the deleteByApplicationInstallationId and countByApplicationInstallationId methods, along with their corresponding interface definitions and unit tests. These changes are consistently applied across the codebase, indicating an intentional removal of functionality. The refactoring improves the overall structure of the repository.
|
MR #73 |
…d implement minor code quality updates
src/Journal/Infrastructure/Doctrine/DoctrineDbalJournalItemRepository.php
Show resolved
Hide resolved
src/Journal/Infrastructure/Doctrine/DoctrineDbalJournalItemRepository.php
Outdated
Show resolved
Hide resolved
…and repository logic, and add `label` and `userId` to `JournalItem`
…ferences across codebase and tests
…atting in `JournalAdminController`, `JournalLogger`, and `JournalItemInterface`
| declare(strict_types=1); | ||
|
|
||
| namespace Bitrix24\Lib\Bitrix24Accounts\ValueObjects; | ||
| namespace Bitrix24\Lib\Kernel\ValueObjects; |
There was a problem hiding this comment.
Нейминг, перенести в Common
| namespace Bitrix24\Lib\ApplicationInstallations\UseCase\Install; | ||
|
|
||
| use Bitrix24\Lib\Bitrix24Accounts\ValueObjects\Domain; | ||
| use Bitrix24\Lib\Kernel\ValueObjects\Domain; |
| * Developer should configure routes in their application | ||
| * Developer should configure routes in their application. | ||
| */ | ||
| class JournalAdminController extends AbstractController |
There was a problem hiding this comment.
Будет вынесен в другой реп, сейчас выпиливаем
| @@ -20,7 +20,8 @@ $factory = $container->get(JournalLoggerFactory::class); | |||
|
|
|||
| // Создаем логгер для конкретной установки приложения | |||
There was a problem hiding this comment.
Доку пересоздадим, когда будет итоговая архитектура журнала
| * PSR-3 compatible factory methods. | ||
| */ | ||
| public static function emergency(Uuid $applicationInstallationId, string $message, JournalContext $context): self | ||
| public static function emergency(string $memberId, Uuid $applicationInstallationId, string $message, string $label, ?string $userId, Context $context): self |
There was a problem hiding this comment.
Убрать методы или объяснить зачем они и для чего используются
| * PSR-3 compatible log level enum | ||
| * PSR-3 compatible log level enum. | ||
| */ | ||
| enum LogLevel: string |
There was a problem hiding this comment.
Зачем? Мы можем использовать PSR-3
| public function deleteOlderThan(CarbonImmutable $date): int | ||
| { | ||
| return $this->getEntityManager()->createQueryBuilder() | ||
| public function deleteOlderThan( |
There was a problem hiding this comment.
Очень не понятно, зачем метод и как он будет использоваться
| /** | ||
| * Read the model repository for journal items with filtering and pagination. | ||
| */ | ||
| readonly class JournalItemReadRepository |
There was a problem hiding this comment.
Репозиторий в доктрине только 1, в 2-х нет смысла. Этот "исторически" был в READmodel, а значит просто объеденить надо с текущим репохиторием
| #[\Override] | ||
| public function log($level, string|\Stringable $message, array $context = []): void | ||
| { | ||
| $logLevel = $this->convertLevel($level); |
There was a problem hiding this comment.
Если мы на вход получаем psr-loglevel, то и преобразований не надо
| public function log($level, string|\Stringable $message, array $context = []): void | ||
| { | ||
| $logLevel = $this->convertLevel($level); | ||
| $label = $context['label'] ?? 'application.log'; |
There was a problem hiding this comment.
"магические строки" внутри метода, выносится в константы
| * @param array<string, mixed> $context | ||
| */ | ||
| #[\Override] | ||
| public function log($level, string|\Stringable $message, array $context = []): void |
There was a problem hiding this comment.
а точно в интерфейсе есть такой метод?
| */ | ||
| class JournalLogger implements LoggerInterface | ||
| { | ||
| use LoggerTrait; |
| * Writes log entries to the journal repository | ||
| * Writes log entries to the journal repository. | ||
| */ | ||
| class JournalLogger implements LoggerInterface |
There was a problem hiding this comment.
Как с помощь/ этого логгера сделать $logger->info('test');
| return new JournalLogger( | ||
| memberId: $memberId, | ||
| applicationInstallationId: $applicationInstallationId, | ||
| repository: $this->repository, |
There was a problem hiding this comment.
Посмотреть зависимости, репозиторий и ЕМ разного уровня зависимости, по идее одного репозитория должно хватить. репо + flusher?
.