Code2Gether-Discord / JokesOnYou

A learning project, A jokes website build as a team project.
12 stars 11 forks source link

Remove UserId from JokeCreateDto #142

Closed heijmn closed 3 years ago

heijmn commented 3 years ago

Currently the JokeCreateDto class contains a UserId property which shouldn't be set by the client API. The server ignores the value anyhow and set's the value itself. So it shouldn't be part of the Dto in the first place.

A UserId is however required to create a valid Joke in the system, so it needs to be retrieved and passed on somewhere. My suggestion would be to keep it simple and make the service responsible for combining the required data and thus provide the data as separate parameters (JokeCreateDto and User / UserId).

HellHunterMax commented 3 years ago

Yes I do agree, I didn't like this way too. My first idea was to add parameters too. We changed it to a more all encompassing Dto. @chrisK00 (I think) suggested we use different Dto's for different parts of the system, which could be a good solution too.