Open
Description
Description
Every time I attempt to convert req.body
using plainToInstance
, it adds a field id:""
.
Minimal code-snippet showcasing the problem
export class Note {
@Exclude()
id = '';
@Expose()
title = '';
@Expose()
content = '';
author = '';
@Expose()
sharedUsers: SharedUsers[] = [];
createdAt?: Date;
updatedAt?: Date;
}
const noteInputDto = plainToInstance(Note, req.body, {
excludeExtraneousValues: true
});
Expected behavior
{
"title":"test",
"content":"test",
"sharedUsers":[]
}
Actual behavior
{
"id": "",
"title": "test",
"content": "test",
"sharedUsers": []
}