Skip to content

Account infrastructure layer#193

Merged
scraft-official merged 4 commits intorelease/0.26from
feature/account-infrastructure-layer
Jan 5, 2026
Merged

Account infrastructure layer#193
scraft-official merged 4 commits intorelease/0.26from
feature/account-infrastructure-layer

Conversation

@scraft-official
Copy link
Copy Markdown
Collaborator

This pull request introduces a full infrastructure layer for persisting and retrieving Account domain objects using JPA, including entity definitions, mapping, and repository implementations. The changes establish a clear separation between the domain and infrastructure layers, enabling robust mapping and database operations for accounts.

Infrastructure Layer Implementation for Account Persistence and Mapping:

Entity and Repository Definitions:

  • Added AccountEntity as a JPA entity representing accounts in the database, including fields for email, metadata, and timestamps. (backend/infrastructure/account/entity/AccountEntity.java)
  • Introduced AccountEntityRepository, a JPA repository interface with custom queries for finding accounts by ID and email, filtered by entity state. (backend/infrastructure/account/entity/repository/AccountEntityRepository.java)
  • Added AccountEntityMeta to encapsulate versioned account metadata. (backend/infrastructure/account/entity/meta/AccountEntityMeta.java)

Mapping Between Domain and Infrastructure:

  • Implemented AccountEntityMapper using MapStruct to convert between Account domain objects and AccountEntity infrastructure entities, including mapping for metadata. (backend/infrastructure/account/entity/mapper/AccountEntityMapper.java)

Repository Implementation and Domain Integration:

  • Updated AccountRepositoryImpl to use the new JPA repository and mapper for all persistence operations, implementing methods to find accounts by ID/email and to save accounts. The class now implements a generic InfrastructureRepository interface and uses constructor injection for dependencies. (backend/infrastructure/account/AccountRepositoryImpl.java)
  • Modified the domain Account class to implement the DomainEntity marker interface, aligning with the new infrastructure repository requirements. (domain/account/Account.java)

Introduced AccountEntity, AccountEntityMeta, and AccountEntityRepository for JPA-based persistence of accounts. Added AccountEntityMapper for mapping between domain and infrastructure entities. Updated AccountRepositoryImpl to use the new infrastructure repository and interfaces, and made Account implement DomainEntity.
Updated AccountRepositoryImpl to use AccountEntityMapper for entity conversions and replaced String state parameters with EntityState in AccountEntityRepository methods. This improves type safety and streamlines entity mapping between domain and infrastructure layers.
Introduced @builder, @AllArgsConstructor (with @deprecated), and @tostring annotations to the Account class to reduce boilerplate and improve object construction and debugging.
Introduced a no-argument constructor to the Account class to support frameworks or tools that require a default constructor for instantiation.
@scraft-official scraft-official merged commit 002348c into release/0.26 Jan 5, 2026
2 checks passed
scraft-official added a commit that referenced this pull request Jan 13, 2026
* Add infrastructure layer for Account entity

Introduced AccountEntity, AccountEntityMeta, and AccountEntityRepository for JPA-based persistence of accounts. Added AccountEntityMapper for mapping between domain and infrastructure entities. Updated AccountRepositoryImpl to use the new infrastructure repository and interfaces, and made Account implement DomainEntity.

* Refactor Account repository to use EntityState and mapper

Updated AccountRepositoryImpl to use AccountEntityMapper for entity conversions and replaced String state parameters with EntityState in AccountEntityRepository methods. This improves type safety and streamlines entity mapping between domain and infrastructure layers.

* Add Lombok annotations to Account class

Introduced @builder, @AllArgsConstructor (with @deprecated), and @tostring annotations to the Account class to reduce boilerplate and improve object construction and debugging.

* Add default constructor to Account class

Introduced a no-argument constructor to the Account class to support frameworks or tools that require a default constructor for instantiation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants