bulletproof-nodejs
bulletproof-nodejs copied to clipboard
Changing a request would require changes in 3 places of the code, is there a better solution?
Hi, as it stands, if we want to change what parameters our client sends us, eg instead of this
export interface IUserInputDTO {
name: string;
email: string;
password: string;
}
We suddenly need
export interface IUserInputDTO {
name: string;
email: string;
password: string;
birthday: string;
}
We would need to change mongoose schema, celebrate body schema and our interface. Is there a better way about this? Or at least add it so the compiler will complain and give us an auto-complete. Writing this three times without the IDE complaining would be really annoying.
Yes I know it sucks, Several projects has been created to aim to solve it but none convinced me at the time of creating this repo.
You con try with Typegoose maybe ?
https://github.com/typegoose/typegoose