Coding task · NestJS course · Module 8: Caching and Performance
Practice: Response Serialization with @Exclude/@Expose
Create a DTO with @Exclude and @Expose decorators to control API responses.
Task
Implement LegionResponseDto with @Expose() on id, name, province fields and @Exclude() on secretCode and passwordHash fields. Add @Transform() on the soldiers field to round the value.