0:00 All right, so in this lecture, let's go ahead and start implementing our 0:04 order create command. We have in the order controller 0:08 our place method. Now we need to actually create a 0:12 place order command and a handler for it. 0:16 So our first step is gonna be to create the command itself. 0:20 So for this, let's follow our typical pattern of inside 0:23 of order, 0:24 we have our 0:26 application directory where we'll host this and all the associated 0:30 handlers, which will be a separate segment of our 0:33 application. 0:34 We know that's separate from the presentation, which is a lower level, more 0:37 volatile layer, but still in between the highest level at 0:41 the domain. 0:42 And so in application, we can now create another directory to 0:45 house our use cases, 0:49 which are gonna be our writes in this case, and we'll add a new 0:52 place order use case. So 0:55 inside of place order, let's create the 0:57 placeOrderCommand.ts. 1:01 So here's the full directory here. 1:05 And now inside of the command, we wanna redeclare the properties 1:08 that we're gonna 1:08 pass to the handler. And again, this is so that we can separate 1:12 the presentation from the application layer. 1:15 We don't wanna be relying on lower level dependencies, in this case, the 1:19 presentation level DTOs, because those are gonna 1:23 change and depend on the chosen presentation layer. 1:26 It's a lower level volatile dependency, and we don't wanna 1:30 rely on it. And so by insulating our 1:33 dependencies like this and redeclaring it, we'll be able to swap this out at 1:37 runtime like we are for our repositories to a totally different 1:41 presentation layer like GraphQL with no change to the 1:44 application layer, and that's the benefit of this approach. 1:48 So we'll define our Place Order Item 1:52 DTO here, which are the properties that get passed in for the
The rest of the transcript is for members.
Sign in