bulletproof-nodejs icon indicating copy to clipboard operation
bulletproof-nodejs copied to clipboard

Changing a request would require changes in 3 places of the code, is there a better solution?

Open Nikola-Milovic opened this issue 3 years ago • 1 comments

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.

Nikola-Milovic avatar Sep 02 '21 09:09 Nikola-Milovic

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

santiq avatar Sep 02 '21 12:09 santiq