hi, is there a way to force the response from typeorm to only return the defined DTO type?
example of a service mehod:
async findAdministrator() :Promise<UserDto> {
return await this.userRepository.findOne({order: { id: 'DESC' }});
}
should only return the defined UserDto properties:
export class UserDto implements Partial<User> {
@Column({
type: 'varchar',
unique: true,
length: 320,
})
username: string;
@Column({
type: 'varchar',
length: 320,
nullable: true,
})
name: string;
@Column({ type: 'text', nullable: true })
avatar?: string;
}
but its returning all properties:
{"created_at":"2023-02-09T14:54:24.854Z","updated_at":"2023-02-09T14:54:24.854Z","id":"k9YQDRUaGht6G5m5pBTIShj9PrQgr-LzH7_y","realm":null,"username":"admin","email":"admin@admin.com","name":"","emailVerified":true,"verificationToken":"s1XkSRtFvr-Djx4g5gXC6","roles":["registered"],"avatar":"/files/get/g--T3d1Z8lShc7xcUsgaPeiWfIIAAuhIE-qk.jpeg"}