0:00 All right. So in this lecture, we're gonna start implementing the domain 0:03 model for 0:04 our new order entity, which is going to actually store the 0:08 orders that users can place, and we're also going to show you how to 0:11 implement aggregate state and variance, as well as storing 0:15 aggregates directly on an entity, in this case, in order to 0:19 encapsulate business logic even further down in our domain model. 0:23 Let's start off by creating a new order directory. 0:27 And inside of order, let's follow our similar pattern where 0:31 I'll 0:31 now create our domain model, which is where we're gonna start. 0:36 It's where we like to start really any new functionality inside of a 0:40 clean architecture, because as we know, the domain model is the 0:44 core of the application that everything else in the application 0:47 then 0:47 relies on, not the other way around. 0:50 And so it makes sense to start with the domain model. 0:53 And so in this case, let's create our new 0:56 entities directory, and we'll start off with the 0:59 OrderEntity.ts. So as we've done 1:03 before, we'll define an interface for the order 1:06 props, which are gonna 1:07 be the internal properties this order exposes from its 1:11 domain model to consumers. And then we'll export class 1:15 Order that will extend the aggregate root, our own 1:19 custom aggregate root. So now we have the empty shell set up. 1:23 Let's go ahead and now add the value objects that this order will 1:27 rely on. And this will have actually some advanced 1:30 business logic, 1:32 again, showing the benefit of keeping this 1:34 coupled together with the data it acts 1:36 on, because this is all gonna live in one 1:38 place in our value 1:40 objects that this order entity will then rely on. 1:43 So inside of domain, let's create a new directory for value 1:47 objects. 1:48 So the value objects that I wanna create, the first one will be the
The rest of the transcript is for members.
Sign in