Skip to content

Implement Response DTOs for Service Layer #14

@caleb-vanlue

Description

@caleb-vanlue

Services return raw database entities directly, exposing internal database structure to API consumers. This creates tight coupling between database schema and API contracts, risks exposing sensitive fields, and makes it difficult to add computed fields or transformations. Any database schema change becomes a breaking API change.

Create dedicated response DTOs for all service methods with proper field mapping. Use class-transformer decorators for entity to DTO transformation. Implement @Exclude() for sensitive fields and @Expose() for computed properties. Ensure all API responses use DTOs rather than entities, providing a stable API contract independent of database structure.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions