Skip to content

User β€” Move DTOs into presentation layer and enforce validationΒ #181

@Villarley

Description

@Villarley

πŸ—‚οΈ Issue: User β€” Move DTOs into presentation layer and enforce validation

Description

The user module has DTOs outside of the presentation layer or mixed with domain code. To align with the architecture, DTOs (HTTP shapes + validation) should live under presentation/dto.

What is expected

  • DTOs moved/created under src/modules/user/presentation/dto/ (e.g., create-user.dto.ts, update-user.dto.ts).
  • Use class-validator/class-transformer for input validation.
  • Controllers import these DTOs and apply the validation middleware.

What should be modified

  • Create/move DTO files to presentation/dto.
  • Update controllers to use DTOs (no raw bodies).
  • Remove duplicate/legacy DTO definitions elsewhere.

Tests

  • Add/adjust tests to assert 400 on invalid payloads and success on valid ones.

Acceptance criteria

  • DTOs live under presentation/dto.
  • Controllers validate input using these DTOs.
  • No duplicate DTOs elsewhere.
  • Tests pass with proper 4xx on invalid data.

Rollback plan

  • Keep pre-change branch/tag.
  • If breakages occur, reintroduce DTOs gradually (endpoint by endpoint).

Metadata

Metadata

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