Skip to content

User β€” Implement repository properly (align with modular architecture)Β #183

@Villarley

Description

@Villarley

πŸ—‚οΈ Issue: User β€” Implement repository properly (align with modular architecture)

Description

The user module needs a clean repository implementation with Prisma, exposing the operations required by its use-cases, and decoupling controllers/services from direct ORM calls.

What is expected

  • A Prisma-backed repository (e.g., user-prisma.repository.ts) implementing the repository interface.
  • Controllers/services interact with the repository interface only.
  • Prisma/infra errors mapped to domain exceptions (Conflict, NotFound, Validation, etc.).
  • Comprehensive tests.

What should be modified

  • Define/complete repository interface and Prisma implementation under src/modules/user/repositories/.
  • Remove direct Prisma calls from presentation/application layers.
  • Ensure DI/factories wire the repository correctly.

Tests

  • Unit tests for repository methods (findById, findByEmail, create, update, delete, etc.).
  • Integration tests through controllers.

Acceptance criteria

  • Only repository touches Prisma.
  • Controllers/services depend on the interface.
  • Domain exceptions used for error mapping.
  • Tests pass (unit + integration for User).

Rollback plan

  • Keep a pre-refactor tag/branch.
  • Revert and re-apply in smaller steps if needed.

Metadata

Metadata

Assignees

Labels

onlydust-waveContribute to awesome OSS repos during OnlyDust's open source week

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions