@nikolovlazar

Welcome to Episode 3! In this episode we're testing the idea of DTOs. I removed them before the stream, but during the stream put more though in and figured out that we're actually going to need them so we got DTOs back in the architecture 😅 We then took a look at the improved Service Locator that also has proper types for the services, and then some more error handling and running the app. Hope you like this one!

P.S. This live stream series is A LOT, so I distilled everything we learned + built a proper demo app that's open source into a 53 minute tutorial: https://youtu.be/jJVAla0dWJo

@lies6086

Hi @nikolovlazar,
Appreciate your hard work. Can you share your github repository of this project so we can have the overview of the whole project?

@llanesluis19

Unfortunately I can't watch the streams live to interact in real time. I'm at minute 12:21 when you explain you removed the DTO and instead ypou return the data subscribed to a specific return type to avoid leaking sensitive info. But in that case youcould still access the rest of the data it only won't suggest in in the intellisense and obviously will say propery doesn't exist but at runtime it will actually show, right?

Would it not be more secure to create a CollectionOutputSchema with zod and pass the data (whole data object) to CollectionOutputSchema.parse(data)?
that way, when you return the data in the service it will only contain the fields from the schema, the rest will be stripped away i believe, that way you really make sure they won't react the client and you get to do validation like it was the DTO.

Sorry to always spam the comments lol :c