1 00:00:00,830 --> 00:00:05,180 Now that we've put our user together we're gonna repeat the same process and create a second file to 2 00:00:05,180 --> 00:00:08,570 represent a company inside of application as well. 3 00:00:08,570 --> 00:00:14,720 So to get started inside of my s RC directory I'll make a new file called company dot t s inside of 4 00:00:14,720 --> 00:00:20,690 here I'm going to once again import the faker module from faker and I'll define a new class and immediately 5 00:00:20,690 --> 00:00:27,780 export it called company so let's think about what different properties we might want a company to have. 6 00:00:27,840 --> 00:00:32,240 I think that maybe if we go back over to the documentation for faker one more time. 7 00:00:32,350 --> 00:00:36,910 Remember we have that company section so we've got different properties in here like say company name 8 00:00:37,240 --> 00:00:40,920 and we've got catchphrase and some other stuff like that as well. 9 00:00:41,080 --> 00:00:44,130 So let's have every company have a company name property. 10 00:00:44,140 --> 00:00:48,190 There'll be a string and a catch phrase property that will be a string as well. 11 00:00:48,190 --> 00:00:53,630 In addition we'll also have a company have a location that will be a latitude and longitude that's going 12 00:00:53,630 --> 00:00:58,210 to represent their physical location the world so we can eventually represent them as a marker on our 13 00:00:58,210 --> 00:00:58,510 map. 14 00:00:59,520 --> 00:00:59,800 OK. 15 00:00:59,810 --> 00:01:07,870 So back over here we'll do a company name that has a string and then we'll do a catchphrase that is 16 00:01:07,870 --> 00:01:14,620 a string we'll also do a location that is giving an object with a latitude property that is a number 17 00:01:15,190 --> 00:01:19,870 and a longitude property that is a number as well. 18 00:01:19,870 --> 00:01:25,570 Now one thing only mentioned here is that calling the company name company name is really not necessary. 19 00:01:25,930 --> 00:01:29,220 I think a much more ideal property name here would be name like so. 20 00:01:29,280 --> 00:01:35,200 But I just want to give it some differentiation from our user who had a name property as well so just 21 00:01:35,200 --> 00:01:38,720 to make a little bit more stark difference between a company and a user. 22 00:01:38,740 --> 00:01:43,060 I'm gonna have the company have a property of company name instead. 23 00:01:43,080 --> 00:01:47,130 All right so now once again we can define our constructor function which is where we're going to initialize 24 00:01:47,370 --> 00:01:49,160 all those different properties. 25 00:01:49,290 --> 00:01:58,010 So I'll say this dot company name will be faker dot company dot company name. 26 00:01:58,020 --> 00:02:00,750 Like so many collapses sidebars we can see that whole line 27 00:02:04,790 --> 00:02:12,980 we can then do our catchphrase which will be fake or dot company dot catchphrase and then finally we 28 00:02:12,980 --> 00:02:16,740 can also initialize our latitude and longitude as well. 29 00:02:16,750 --> 00:02:22,370 Remember like we just discussed this right here does not initialize the location property. 30 00:02:22,370 --> 00:02:25,780 It just tells typescript here's what location will be. 31 00:02:25,790 --> 00:02:31,160 So if we try to assign a value directly to this dot location dot let we'll get an error message because 32 00:02:31,160 --> 00:02:34,730 location is undefined inside the constructor. 33 00:02:34,730 --> 00:02:38,920 So we have to initialize the location property and everything inside of it. 34 00:02:39,020 --> 00:02:45,680 And one easy way to do that is to say this dot location is going to be an object with properties lat 35 00:02:46,310 --> 00:02:56,240 and LNG then side of here we can once do again do a fake dot address dot latitude make sure you get 36 00:02:56,240 --> 00:03:00,980 the comma at the end of the line and then faker address dot longitude as well. 37 00:03:00,980 --> 00:03:04,870 And once again don't forget the parentheses. 38 00:03:04,890 --> 00:03:09,410 All right we're seeing the same errors error as before we are trying to take a string because that is 39 00:03:09,410 --> 00:03:13,270 what we get back from faker and assign it to a property that's supposed to be a number. 40 00:03:13,280 --> 00:03:14,870 So once again we have to do a pass float 41 00:03:18,190 --> 00:03:19,540 and a past float 42 00:03:23,210 --> 00:03:25,610 and that's it. 43 00:03:25,780 --> 00:03:26,110 All right. 44 00:03:26,110 --> 00:03:27,350 So I think we're all set here. 45 00:03:27,360 --> 00:03:32,080 We already got that export statement so now we can import this into our index dot t yes file create 46 00:03:32,080 --> 00:03:36,250 an instance of a company really quickly and just make sure everything works as expected. 47 00:03:36,450 --> 00:03:45,020 So back inside of index dot yes I will import company from company and then underneath our user I'll 48 00:03:45,020 --> 00:03:52,970 say company is going to be a new company like so and I'll do a console log of that company 49 00:03:56,920 --> 00:04:01,120 then as a quick test I'll flip back on my browser my library load already kicked in and I can see that 50 00:04:01,120 --> 00:04:03,160 console log right here. 51 00:04:03,160 --> 00:04:08,440 So I'll expand company and I'll see that I've got a really great catch phrase persistent directional 52 00:04:08,440 --> 00:04:14,260 function and my company name is King group once again really should not be calling that property company 53 00:04:14,260 --> 00:04:18,670 name just name would be much more appropriate because we really know that it is a company we're working 54 00:04:18,670 --> 00:04:19,630 with. 55 00:04:19,720 --> 00:04:23,620 However once again we want to just differentiate the company from the user which had a name property 56 00:04:24,750 --> 00:04:29,180 and once again I've got a location with a latitude and longitude as well all right. 57 00:04:29,180 --> 00:04:29,870 So that's pretty much it. 58 00:04:29,880 --> 00:04:33,900 We've created a class to represent our user and our company. 59 00:04:33,960 --> 00:04:35,390 So let's take another quick pause right here. 60 00:04:35,400 --> 00:04:39,630 When we come back the next section we're gonna start working on getting a Google map to display on our 61 00:04:39,630 --> 00:04:40,510 screen as well. 62 00:04:40,680 --> 00:04:42,090 So I'll see you in just a minute.