Skip to content

NFT — Implement repository properly (align with modular architecture) #179

@Villarley

Description

@Villarley

🗂️ Issue: NFT — Implement repository properly (align with modular architecture)

Description

The nft module needs a proper repository implementation aligned with the project’s modular/DDD architecture and Prisma. Some data access still happens directly in services/controllers or via ad-hoc helpers, which makes testing and maintenance harder.

What is expected

  • A concrete Prisma-based repository (e.g., nft-prisma.repository.ts) that implements the module repository interface.
  • Controllers/use-cases depend only on the repository interface, not on Prisma directly.
  • Proper mapping of infra errors (e.g., Prisma unique conflicts) to domain exceptions.
  • Unit tests for repository and integration tests for controller flows.

What should be modified

  • Create/complete repository interface and its Prisma implementation under src/modules/nft/repositories/.
  • Refactor services/use-cases to receive the repository via constructor/factory.
  • Remove direct Prisma/DB calls from controllers.
  • Ensure DI/factory wiring is updated where the module is composed.

Tests

  • Add unit tests for repository methods (create/find/update/delete or the NFT-specific ops you expose).
  • Integration tests that go through controller → use-case → repository.

Acceptance criteria

  • Only the repository touches Prisma.
  • Controllers/services use the repository interface.
  • Domain exceptions used for error mapping.
  • Tests green (unit + integration for NFT).

Rollback plan

  • Keep a pre-refactor branch/tag.
  • If regressions appear, revert and re-apply incrementally (repo first, then consumers).

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