✅ Flow of registering a new user
I have got help here with creating the flow of the user-registration in my project.
I was recommended in this discord to create 3 layers:
dto -> second layer (which gpt named domain) -> Model. I managed to create this flow, but now I have 1 problem:
In which layer I suppose to put restrictions like "confirm password must match first-password" or "password has to contain at least 8 digits" or "FirstName much contain only letters", etc... for example: (picture)
Some good people here told me to leave the DTO totally empty, with no restrictions because DTO only responsible for transferring data - not holding invariants, but chatGPT told me to put basic restrictions like [required] and length.
GPT also told me not to put restrictions inside the domain layer and only to check the input it-self if it's null or empty, but now it makes no sense... Because I can't enforce and put restrictions in the Model layer since I don't check this part, I only store it into the database...
Clarifies: I trust more the discord than chatGPT, but GPT helped me to do the things I didn't understand, so I had to listen when I was lost in the process.
So what to do, because I'm a bit confused
Thank you!!!
I was recommended in this discord to create 3 layers:
dto -> second layer (which gpt named domain) -> Model. I managed to create this flow, but now I have 1 problem:
In which layer I suppose to put restrictions like "confirm password must match first-password" or "password has to contain at least 8 digits" or "FirstName much contain only letters", etc... for example: (picture)
Some good people here told me to leave the DTO totally empty, with no restrictions because DTO only responsible for transferring data - not holding invariants, but chatGPT told me to put basic restrictions like [required] and length.
GPT also told me not to put restrictions inside the domain layer and only to check the input it-self if it's null or empty, but now it makes no sense... Because I can't enforce and put restrictions in the Model layer since I don't check this part, I only store it into the database...
Clarifies: I trust more the discord than chatGPT, but GPT helped me to do the things I didn't understand, so I had to listen when I was lost in the process.
So what to do, because I'm a bit confused
Thank you!!!

