Skip to content

Add Journal entity support with PSR-3 compatibility#83

Open
KarlsonComplete wants to merge 6 commits intomesilov:claude/implement-issue-72-01PyCT5q1ySkhYBu5ehAcnL9from
KarlsonComplete:claude/implement-issue-72-01PyCT5q1ySkhYBu5ehAcnL9
Open

Add Journal entity support with PSR-3 compatibility#83
KarlsonComplete wants to merge 6 commits intomesilov:claude/implement-issue-72-01PyCT5q1ySkhYBu5ehAcnL9from
KarlsonComplete:claude/implement-issue-72-01PyCT5q1ySkhYBu5ehAcnL9

Conversation

@KarlsonComplete
Copy link
Collaborator

.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 JournalItemRepository implementation for Doctrine DBAL, transitioning from inheritance to composition for improved maintainability and testability. It also streamlines the JournalItemRepositoryInterface by removing two specific methods, deleteByApplicationInstallationId and countByApplicationInstallationId, along with their corresponding implementations and tests, thereby focusing the repository's contract and responsibilities.

Highlights

  • Refactored Doctrine Repository: The DoctrineDbalJournalItemRepository was refactored to use composition over inheritance, no longer extending Doctrine\ORM\EntityRepository directly. It now holds a private readonly EntityRepository instance.
  • Simplified Repository Interface: The JournalItemRepositoryInterface was simplified by removing the deleteByApplicationInstallationId and countByApplicationInstallationId methods.
  • Removed Unused Functionality: Corresponding implementations and tests for the removed repository methods were also removed from InMemoryJournalItemRepository and InMemoryJournalItemRepositoryTest.

🧠 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
  • src/Journal/Infrastructure/Doctrine/DoctrineDbalJournalItemRepository.php
    • Changed class inheritance from EntityRepository to direct implementation of JournalItemRepositoryInterface.
    • Introduced a private readonly EntityRepository $repository property for managing JournalItem entities.
    • Updated __construct, save, findById, and findByApplicationInstallationId methods to utilize the new $repository property.
    • Removed the deleteByApplicationInstallationId and countByApplicationInstallationId methods.
  • src/Journal/Infrastructure/JournalItemRepositoryInterface.php
    • Removed the deleteByApplicationInstallationId and countByApplicationInstallationId method declarations.
  • tests/Unit/Journal/Infrastructure/InMemory/InMemoryJournalItemRepository.php
    • Removed the deleteByApplicationInstallationId and countByApplicationInstallationId methods.
  • tests/Unit/Journal/Infrastructure/InMemoryJournalItemRepositoryTest.php
    • Removed the testDeleteByApplicationInstallationId and testCountByApplicationInstallationId test methods.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 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.

@KarlsonComplete
Copy link
Collaborator Author

KarlsonComplete commented Feb 12, 2026

MR #73

Copy link
Collaborator

@camaxtly camaxtly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15-02-2026

…and repository logic, and add `label` and `userId` to `JournalItem`
…atting in `JournalAdminController`, `JournalLogger`, and `JournalItemInterface`
declare(strict_types=1);

namespace Bitrix24\Lib\Bitrix24Accounts\ValueObjects;
namespace Bitrix24\Lib\Kernel\ValueObjects;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нейминг, перенести в Common

namespace Bitrix24\Lib\ApplicationInstallations\UseCase\Install;

use Bitrix24\Lib\Bitrix24Accounts\ValueObjects\Domain;
use Bitrix24\Lib\Kernel\ValueObjects\Domain;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нейминг

* Developer should configure routes in their application
* Developer should configure routes in their application.
*/
class JournalAdminController extends AbstractController
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Будет вынесен в другой реп, сейчас выпиливаем

@@ -20,7 +20,8 @@ $factory = $container->get(JournalLoggerFactory::class);

// Создаем логгер для конкретной установки приложения
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Доку пересоздадим, когда будет итоговая архитектура журнала

Copy link
Collaborator

@camaxtly camaxtly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1-03-2026

* 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Убрать методы или объяснить зачем они и для чего используются

* PSR-3 compatible log level enum
* PSR-3 compatible log level enum.
*/
enum LogLevel: string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем? Мы можем использовать PSR-3

public function deleteOlderThan(CarbonImmutable $date): int
{
return $this->getEntityManager()->createQueryBuilder()
public function deleteOlderThan(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень не понятно, зачем метод и как он будет использоваться

/**
* Read the model repository for journal items with filtering and pagination.
*/
readonly class JournalItemReadRepository
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Репозиторий в доктрине только 1, в 2-х нет смысла. Этот "исторически" был в READmodel, а значит просто объеденить надо с текущим репохиторием

#[\Override]
public function log($level, string|\Stringable $message, array $context = []): void
{
$logLevel = $this->convertLevel($level);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если мы на вход получаем psr-loglevel, то и преобразований не надо

public function log($level, string|\Stringable $message, array $context = []): void
{
$logLevel = $this->convertLevel($level);
$label = $context['label'] ?? 'application.log';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"магические строки" внутри метода, выносится в константы

* @param array<string, mixed> $context
*/
#[\Override]
public function log($level, string|\Stringable $message, array $context = []): void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а точно в интерфейсе есть такой метод?

*/
class JournalLogger implements LoggerInterface
{
use LoggerTrait;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

откуда трейт?

* Writes log entries to the journal repository
* Writes log entries to the journal repository.
*/
class JournalLogger implements LoggerInterface
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как с помощь/ этого логгера сделать  $logger->info('test');

return new JournalLogger(
memberId: $memberId,
applicationInstallationId: $applicationInstallationId,
repository: $this->repository,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Посмотреть зависимости, репозиторий и ЕМ разного уровня зависимости, по идее одного репозитория должно хватить. репо + flusher?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants