1 00:00:01,090 --> 00:00:04,820 The tests around our two listeners are looking pretty good so I'm not going to start to move on to a 2 00:00:04,820 --> 00:00:06,260 couple of other things. 3 00:00:06,530 --> 00:00:09,800 I put together a quick diagram just to help you understand what we're going to do in the next couple 4 00:00:09,800 --> 00:00:10,330 of videos. 5 00:00:10,340 --> 00:00:15,320 And I did this just because right now we have to tackle a couple of little side topics really quickly. 6 00:00:15,320 --> 00:00:20,060 Just some kind of administrative stuff to make sure everything works as expected and whenever we go 7 00:00:20,060 --> 00:00:24,470 through these kind of Diskin jointed topics it's really easy to get lost and lose sight of what we're 8 00:00:24,470 --> 00:00:25,630 really trying to do. 9 00:00:25,640 --> 00:00:28,580 So this is what we're going to try to achieve in the next couple of videos. 10 00:00:28,580 --> 00:00:33,620 First we're gonna add in the Mongoose update if current module into the orders model. 11 00:00:33,620 --> 00:00:38,630 The reason for this is that we want to add that same kind of version system around orders just as we 12 00:00:38,630 --> 00:00:40,280 have it around tickets. 13 00:00:40,280 --> 00:00:45,410 We're going to eventually emit events or publish a lot of events and listen to a lot of events around 14 00:00:45,440 --> 00:00:50,180 orders changing over time and just like with tickets we need to make sure we process those events in 15 00:00:50,180 --> 00:00:51,060 the correct order. 16 00:00:51,120 --> 00:00:55,760 And so we're always gonna do that by wiring up this update if current module after that. 17 00:00:55,760 --> 00:01:00,650 We're then going to fix up a couple of tests so in particular we're going to make sure that whenever 18 00:01:00,650 --> 00:01:06,730 we are creating tickets inside of our order service we may need to make sure that we provide an I.D.. 19 00:01:06,810 --> 00:01:10,340 This is tied to some of the stuff we just went through in the last couple of videos remember we want 20 00:01:10,340 --> 00:01:14,600 to make sure we have a consistent I.D. for all the tickets that are created between our ticket service 21 00:01:14,840 --> 00:01:16,770 and the order service. 22 00:01:16,790 --> 00:01:21,620 However we have a lot of code inside the order service right now that creates tickets without providing 23 00:01:21,620 --> 00:01:22,550 an I.D.. 24 00:01:22,550 --> 00:01:26,990 So we have to go hunt around in a couple locations and find those locations and just make sure we provide 25 00:01:26,990 --> 00:01:29,490 an I.D. whenever we create a ticket. 26 00:01:29,540 --> 00:01:34,970 And then finally last thing just a little bit ago we made an update to our cone module and we said that 27 00:01:35,030 --> 00:01:38,380 all of our different events were going to include a version flag. 28 00:01:38,390 --> 00:01:44,150 However we do have two locations inside the order service where we are emitting information or publishing 29 00:01:44,150 --> 00:01:49,280 information about in order and we are currently not including a version property when we are publishing 30 00:01:49,280 --> 00:01:50,190 those events. 31 00:01:50,240 --> 00:01:54,500 And so that those right now are causing a typescript error typescript is saying we want to publish this 32 00:01:54,500 --> 00:01:58,370 event you have to provide a version guess that's it that's a we're going to go through. 33 00:01:58,490 --> 00:02:05,470 Let's start first right now with the Mongoose update if current module in the orders model so inside 34 00:02:05,470 --> 00:02:13,030 my order service I'm going to find the order model file at the very top I will import the 35 00:02:15,640 --> 00:02:24,030 plugin update if current plugin from Mongoose update if current 36 00:02:27,890 --> 00:02:36,070 well then go down to right after our schema right after the order schema we'll throw in here order schema 37 00:02:36,770 --> 00:02:43,860 not set version key and again we're gonna set it to version and then right after that we're going to 38 00:02:43,860 --> 00:02:52,800 tell this schema to make use of that plugin tool at an order schema that plugin and pass an update if 39 00:02:52,890 --> 00:02:54,270 current plugin. 40 00:02:54,410 --> 00:02:54,770 There we go. 41 00:02:56,630 --> 00:02:57,530 Last thing to do. 42 00:02:57,530 --> 00:03:04,670 We're gonna go back up to our order document interface so again remember this describes all the properties 43 00:03:04,670 --> 00:03:10,910 that an order has the Mongoose document interface says that a document has an underscore underscore 44 00:03:10,910 --> 00:03:15,980 of the property which is usually used for checking versions but as we discussed many times we are recording 45 00:03:15,980 --> 00:03:17,930 our versions on a version property. 46 00:03:17,930 --> 00:03:22,610 So just so we can access that version property we have to add it to this order dock interface. 47 00:03:22,640 --> 00:03:27,490 And that's just to make typescript happy and understand that all orders have a version property that 48 00:03:27,500 --> 00:03:35,360 will add inside of your version is going to be a number and that's it go get so that's step number one. 49 00:03:35,360 --> 00:03:36,490 Let's take a quick pause right here. 50 00:03:36,500 --> 00:03:39,260 When we come back next video we're going to fix up a couple of tests.