1 00:00:02,300 --> 00:00:07,490 Welcome back, ladies and gentlemen, and let's do the final part of this project, so our final will 2 00:00:07,490 --> 00:00:16,830 be like so when whenever we like a movie and after that we can dislike that movie, we can remove that 3 00:00:16,830 --> 00:00:17,920 flag and stuff like that. 4 00:00:17,930 --> 00:00:24,770 No, we have after this one or two lectures, saving, storing something in the local storage. 5 00:00:24,770 --> 00:00:26,580 And pretty much we are done now. 6 00:00:26,690 --> 00:00:30,950 Congratulations if you're about to hear your Golden True-Blue now, first things first. 7 00:00:31,190 --> 00:00:33,110 I want Indy views. 8 00:00:34,070 --> 00:00:36,170 Actually, let's start with a model not being used. 9 00:00:36,170 --> 00:00:39,200 We never started with a view, so I'm going to say it like that. 10 00:00:39,210 --> 00:00:42,410 Jazz and same as the cards here. 11 00:00:43,820 --> 00:00:45,440 We're going to do something similar. 12 00:00:45,440 --> 00:00:45,760 Right? 13 00:00:46,040 --> 00:00:50,480 So I'm not going to copy and paste this one here because they are very much alike. 14 00:00:50,840 --> 00:00:53,750 But let's create it together now. 15 00:00:53,750 --> 00:00:54,470 First things first. 16 00:00:54,620 --> 00:00:58,310 I want to export default class. 17 00:00:58,970 --> 00:01:03,350 Like by now, you know how to do this, right? 18 00:01:03,890 --> 00:01:12,980 And inside I will have the constructor that will be empty and these that likes it will be like this. 19 00:01:13,010 --> 00:01:13,400 Right. 20 00:01:13,550 --> 00:01:20,650 So we will create these that likes area that will set back to empty whenever we create or we call this 21 00:01:20,660 --> 00:01:23,180 one from the index from the main controller. 22 00:01:23,210 --> 00:01:23,540 Right. 23 00:01:23,870 --> 00:01:30,530 And that will go here and we'll say, OK, yeah, we don't have anything, no parameters to parse. 24 00:01:30,530 --> 00:01:32,900 We're just going to create an object for from that class. 25 00:01:33,060 --> 00:01:33,460 Nice. 26 00:01:34,190 --> 00:01:40,760 The second thing that we need to do is actually we seem to add like a movie. 27 00:01:40,910 --> 00:01:41,330 Right. 28 00:01:41,870 --> 00:01:46,040 So here I have the idea, the poster. 29 00:01:47,000 --> 00:01:47,420 What else? 30 00:01:47,420 --> 00:01:50,380 I will have the title The Year. 31 00:01:51,590 --> 00:01:53,920 Now you can include as much as many things, but I. 32 00:01:54,490 --> 00:02:01,460 I don't think so for this is more this is more than enough for this course is more than enough to include 33 00:02:01,460 --> 00:02:02,090 all of this. 34 00:02:02,480 --> 00:02:11,870 Now inside I will create an object called like and remember last time we just call those things in the 35 00:02:12,050 --> 00:02:15,260 poster without setting the dates right. 36 00:02:15,350 --> 00:02:15,980 Tyto 37 00:02:18,590 --> 00:02:23,720 here in the last one was I am DBI really cool. 38 00:02:24,350 --> 00:02:27,170 Now semicolon on that one. 39 00:02:27,440 --> 00:02:28,820 So let's continue working. 40 00:02:28,850 --> 00:02:36,770 So but we need actually to push this like back to the like stage so we're not finished quite yet. 41 00:02:36,800 --> 00:02:45,800 OK, now how we do this, these, that likes that push, we've got to push this like the same as we 42 00:02:45,800 --> 00:02:47,210 did with item for the car. 43 00:02:47,210 --> 00:02:48,560 We're going to push this like here. 44 00:02:49,130 --> 00:02:52,760 And after that we need to return the leg. 45 00:02:54,230 --> 00:02:54,710 Nice. 46 00:02:55,700 --> 00:02:56,930 So we are done with this. 47 00:02:56,930 --> 00:03:06,860 Add like now the second thing that it will be for delete delete like a movie in here we need to pass 48 00:03:06,860 --> 00:03:07,910 the ID remember. 49 00:03:08,060 --> 00:03:10,550 So it's a pretty much complete list scene const. 50 00:03:11,270 --> 00:03:17,220 So I'm just going to be or go through this because you already know this, these that likes. 51 00:03:17,900 --> 00:03:25,460 So I'm calling the the, the error here and I'm using the find index. 52 00:03:25,640 --> 00:03:28,160 So what this will do, it will loop through all of them. 53 00:03:28,550 --> 00:03:29,510 It will fine. 54 00:03:29,600 --> 00:03:36,170 So I have the access to the current element and if I say current idee is equal to the ID. 55 00:03:36,170 --> 00:03:36,650 Nice. 56 00:03:36,830 --> 00:03:39,830 Last time we just made a huge mistake here. 57 00:03:40,190 --> 00:03:41,090 I had one. 58 00:03:41,090 --> 00:03:42,620 Only one equals sign. 59 00:03:42,620 --> 00:03:42,920 Right. 60 00:03:43,610 --> 00:03:53,510 So it will find and it will store the current index here now this that likes that spliffs. 61 00:03:53,540 --> 00:03:55,730 So we're going to use against list in. 62 00:03:55,730 --> 00:03:59,210 You already know that we need to pass the index in how many positions. 63 00:03:59,360 --> 00:04:03,320 Actually I want only that to be deleted right now. 64 00:04:03,500 --> 00:04:04,250 That's pretty much it. 65 00:04:04,550 --> 00:04:05,420 Now what's next. 66 00:04:05,600 --> 00:04:09,500 OK, let's create no. 67 00:04:10,820 --> 00:04:16,940 So last time I promise you that I'm going to have show likes before what show list. 68 00:04:16,940 --> 00:04:18,780 And now it will be show likes. 69 00:04:19,190 --> 00:04:28,400 And now here what we can do is actually return this that likes the entire one or we can return the length. 70 00:04:28,640 --> 00:04:29,000 Right. 71 00:04:29,720 --> 00:04:38,570 But for the length I'm going to create additional function and that will be number of likes in here. 72 00:04:38,570 --> 00:04:41,540 I will say this, that likes that length. 73 00:04:42,230 --> 00:04:42,720 Nice. 74 00:04:42,720 --> 00:04:43,820 So I have two functions. 75 00:04:44,780 --> 00:04:47,540 Maybe for some reason you want the entire array. 76 00:04:47,690 --> 00:04:49,100 That's why I'm just leaving over there. 77 00:04:49,460 --> 00:04:52,460 It's not going to kill me if I tried to create another function. 78 00:04:52,670 --> 00:04:54,830 OK, that's pretty much it. 79 00:04:54,830 --> 00:04:56,030 No, no, no, it's not pretty much. 80 00:04:56,120 --> 00:05:00,200 We need to just check to do one additional function. 81 00:05:00,440 --> 00:05:10,260 And that will actually check the movie like status now, life status, so these will be super useful. 82 00:05:10,370 --> 00:05:16,490 But here we need to pass in the idea as well and it will return to the false right. 83 00:05:16,500 --> 00:05:19,020 But you will see something interesting here. 84 00:05:19,220 --> 00:05:22,970 So these not like and I'm going to search for to find the index. 85 00:05:23,870 --> 00:05:24,290 Right. 86 00:05:24,620 --> 00:05:31,000 And I'm going to do the exactly same like like exactly like this. 87 00:05:31,010 --> 00:05:37,040 But look what I will do now if this is different than minus one. 88 00:05:38,720 --> 00:05:39,160 Right. 89 00:05:39,650 --> 00:05:45,920 So means that if you couldn't find any of the index I'm searching for that it will return minus one 90 00:05:45,920 --> 00:05:47,900 and minus one is false. 91 00:05:48,880 --> 00:05:49,520 So true. 92 00:05:49,520 --> 00:05:51,590 There always it's like that. 93 00:05:51,620 --> 00:05:54,560 So that will return me instead of passing here. 94 00:05:54,560 --> 00:05:56,510 False, I can just pass minus one. 95 00:05:56,720 --> 00:05:58,580 If I pass one it will return. 96 00:05:58,580 --> 00:05:58,730 True. 97 00:05:58,730 --> 00:06:03,050 But this will never go here actually if this finds it right. 98 00:06:03,650 --> 00:06:05,590 So you will see what I'm trying to say here. 99 00:06:05,840 --> 00:06:08,410 Now that is pretty much it for this picture. 100 00:06:08,420 --> 00:06:09,680 So that was super short. 101 00:06:10,010 --> 00:06:16,430 And I promise that I'm going to do a separate lecture for models, views, controllers. 102 00:06:16,430 --> 00:06:19,730 Sometimes it's not possible, but this is the time when it's possible. 103 00:06:19,740 --> 00:06:24,380 So I just want to make this super short and I will see you in the next one where we are going to build 104 00:06:24,380 --> 00:06:25,370 the likes of you.