1
00:00:00,740 --> 00:00:01,430
Welcome back.

2
00:00:01,790 --> 00:00:06,780
Now what we need to do is that we need to work on creating a movie so we already have.

3
00:00:06,800 --> 00:00:09,350
Remember, we already have this endpoint.

4
00:00:09,350 --> 00:00:15,410
Let me uncomment this endpoint, which creates a a a resource here.

5
00:00:15,410 --> 00:00:17,450
In our case, we create a movie.

6
00:00:17,960 --> 00:00:22,010
However, this time we need to create a movie and inserted into our database.

7
00:00:22,700 --> 00:00:31,070
So what we want to do is that we want to use Skew Il here in this endpoint point in order to insert

8
00:00:31,070 --> 00:00:33,080
a new movie into our database.

9
00:00:34,190 --> 00:00:39,800
So what I'm going to do is that I'm going to hear, as we learned earlier, how to use a scale here.

10
00:00:39,800 --> 00:00:47,420
We need to say in this create movie endpoint or function, we need to say scale is equal to and then

11
00:00:47,420 --> 00:00:51,610
the SKU will command that insert something into the database.

12
00:00:51,620 --> 00:01:00,710
In our case, it's a movie it's insert insert into and then the name of the table.

13
00:01:01,070 --> 00:01:07,240
The name of the table is movies, movies, insert into movies and then what do we want to insert?

14
00:01:07,250 --> 00:01:08,270
We want insert.

15
00:01:08,930 --> 00:01:10,180
Let me show you what you want.

16
00:01:10,200 --> 00:01:14,740
Insert what we want in certain that we want to insert for every single movie we want.

17
00:01:14,760 --> 00:01:18,080
Insert the title the year and the storyline.

18
00:01:18,620 --> 00:01:22,940
The idea will be given by the database so you don't have to worry about it.

19
00:01:23,990 --> 00:01:26,000
So here I'm going to say title.

20
00:01:27,300 --> 00:01:30,090
And then Karma and then here.

21
00:01:32,140 --> 00:01:35,290
And then Karma and then storyline.

22
00:01:36,670 --> 00:01:37,420
Story.

23
00:01:39,440 --> 00:01:39,870
Line.

24
00:01:42,660 --> 00:01:45,690
And then we need to upend the values.

25
00:01:46,140 --> 00:01:53,180
So we need to say values, values, what are the values, the values here?

26
00:01:53,190 --> 00:01:57,180
We need to add blanks so that we can fill these blanks later.

27
00:01:57,180 --> 00:02:04,590
So I'm going to say here percentage of then s and then comma and the percentage is and then comma and

28
00:02:04,590 --> 00:02:07,710
the percentage is because we need three blanks.

29
00:02:07,710 --> 00:02:09,270
We need a blank for the title.

30
00:02:09,780 --> 00:02:16,500
We need another blank for the year and we need another and third and final blank for the storyline.

31
00:02:17,760 --> 00:02:20,130
Now we need to get these values.

32
00:02:20,130 --> 00:02:23,160
We need to get the title, the the storyline from the user.

33
00:02:24,030 --> 00:02:33,120
So in a new line, I'm going to say Val is equal to and then I'm going to say here in a couple, I'm

34
00:02:33,120 --> 00:02:38,520
going to get the movie, which is this, which is obviously a dictionary.

35
00:02:39,240 --> 00:02:41,340
So we need to say here.

36
00:02:42,620 --> 00:02:43,370
Movie.

37
00:02:44,680 --> 00:02:51,630
And then what we want to access from that dictionary, we want to access first the title and then come

38
00:02:51,650 --> 00:02:51,790
on.

39
00:02:53,670 --> 00:03:04,380
Come on here and then movie and then when you want to access the year and then karma and then we want

40
00:03:04,380 --> 00:03:06,270
to access the storyline.

41
00:03:07,960 --> 00:03:10,100
Story line.

42
00:03:11,410 --> 00:03:21,670
And finally, we need to upend these values to the scale, so we need to say my are not excused.

43
00:03:22,300 --> 00:03:24,580
And then when you want to pass the rescue ill.

44
00:03:25,610 --> 00:03:33,650
A school at the valley, and then we finally we say here, we don't need this anymore, we need to remove

45
00:03:33,650 --> 00:03:34,190
this line.

46
00:03:36,140 --> 00:03:38,750
And then after we execute, we need to.

47
00:03:39,810 --> 00:03:47,400
Use a very important function, unlike here, unlike unlike getting something from the database, we

48
00:03:47,400 --> 00:03:49,320
need to call a function called comment.

49
00:03:50,430 --> 00:03:52,440
We need to say my database.

50
00:03:52,500 --> 00:03:53,760
Dot com.

51
00:03:54,830 --> 00:03:55,740
Comment.

52
00:03:57,870 --> 00:04:04,290
So this function, if you don't call this function data, wouldn't be inserted into the database.

53
00:04:04,740 --> 00:04:06,090
This is very, very important.

54
00:04:06,540 --> 00:04:12,810
The comment function is required whenever you are altering something in the database.

55
00:04:13,050 --> 00:04:13,920
It's so important.

56
00:04:14,580 --> 00:04:17,610
Finally, we need to return that movie that has been inserted.

57
00:04:17,610 --> 00:04:19,320
So I'm going to say a movie.

58
00:04:20,340 --> 00:04:21,390
I'm going to return the movie.

59
00:04:22,050 --> 00:04:26,190
That's it out, click on file and then save on a little test.

60
00:04:27,090 --> 00:04:36,440
So now I'm going to refresh and then we should have a new you are going to can see we have and you you

61
00:04:36,510 --> 00:04:36,590
are.

62
00:04:36,630 --> 00:04:38,430
Alcohol can get moody.

63
00:04:38,670 --> 00:04:41,400
Maybe click on it a let me or click on.

64
00:04:41,400 --> 00:04:44,390
Try it out that let's insert a new movie.

65
00:04:44,400 --> 00:04:46,710
So here I'm going to say.

66
00:04:48,690 --> 00:04:50,790
First, we need the title.

67
00:04:51,060 --> 00:04:52,050
So I'm going to say a title.

68
00:04:54,830 --> 00:04:56,440
Then let me straight to you and your movie.

69
00:05:00,090 --> 00:05:03,840
Let's hear Rio and then here.

70
00:05:09,900 --> 00:05:12,150
And then storyline.

71
00:05:14,160 --> 00:05:16,440
Story line.

72
00:05:29,920 --> 00:05:33,400
Then all we need to do is that we need to click on, execute and see what's going to happen.

73
00:05:33,430 --> 00:05:34,900
So let me click on Execute.

74
00:05:38,010 --> 00:05:43,260
And as you can see here, it says two hundred success and a year, the movie has been returned.

75
00:05:43,650 --> 00:05:49,860
Now, in order to verify that you can do two things, you can either open up the database and refresh

76
00:05:49,860 --> 00:05:51,990
your table, maybe click on the table.

77
00:05:52,620 --> 00:05:54,120
So the table will be refreshed.

78
00:05:54,540 --> 00:05:56,610
And as you can see, a new movie has been inserted.

79
00:05:57,180 --> 00:05:59,010
As you can see, a new movie has been inserted.

80
00:05:59,790 --> 00:06:04,320
And you can also get all of the movies now here by using the movies.

81
00:06:04,830 --> 00:06:07,680
Of course, you are going to get the movie that has just been inserted.

82
00:06:08,430 --> 00:06:12,660
If you click on, try it out and then execute.

83
00:06:13,290 --> 00:06:20,640
As you can see, you will get the movie serial, which has been inserted, which is the latest movie

84
00:06:20,640 --> 00:06:24,300
that has been or the last movie that has been inserted into the database.
