1
00:00:00,180 --> 00:00:00,600
Beautiful.

2
00:00:00,990 --> 00:00:04,080
And we're going to start by setting up a three token model.

3
00:00:04,800 --> 00:00:09,690
So that's the only model we'll create extra in this project.

4
00:00:10,170 --> 00:00:17,310
And the way it's going to work, we're going to create token JASS in the models folder that we want

5
00:00:17,310 --> 00:00:24,360
to create a refreshed token IP user agent properties all string are required.

6
00:00:24,930 --> 00:00:28,980
We also want to set up is valid, which is going to be a Boolean.

7
00:00:29,370 --> 00:00:31,560
Now, by default, it is going to be true.

8
00:00:32,310 --> 00:00:35,460
And also, we want to tie this to a user.

9
00:00:35,820 --> 00:00:40,500
So we want to set up a reference where we're looking for the user model.

10
00:00:41,280 --> 00:00:47,550
And then lastly, I also want to set up the timestamps and, you know, the Russian export model and

11
00:00:47,550 --> 00:00:48,690
yada yada, yada yada.

12
00:00:49,140 --> 00:00:52,020
So let's go here to a new model.

13
00:00:52,890 --> 00:00:53,180
Here.

14
00:00:53,620 --> 00:00:55,200
Duncan, J.

15
00:00:55,380 --> 00:00:55,740
Yes.

16
00:00:56,280 --> 00:00:59,560
And let's just start by setting everything up.

17
00:01:00,000 --> 00:01:01,200
We want to get the Mongoose.

18
00:01:01,590 --> 00:01:01,950
Correct.

19
00:01:02,250 --> 00:01:03,210
That's the first step.

20
00:01:04,060 --> 00:01:12,280
So let's go here with Mongoose and not require our package why, and we want to create that schema concept

21
00:01:13,000 --> 00:01:21,370
token schema is equal to new mongoose dot and line schema and side of it.

22
00:01:21,940 --> 00:01:32,410
Like I said, I'll start with refreshed token type string string, and then wired is set to true.

23
00:01:32,620 --> 00:01:33,640
I'd say about one.

24
00:01:34,180 --> 00:01:40,780
I'll copy and paste that one two more times, and I just need to change some values around here.

25
00:01:40,780 --> 00:01:43,060
So this is not going to be a fresh token.

26
00:01:43,630 --> 00:01:45,100
It's going to be an IP address.

27
00:01:45,490 --> 00:01:51,740
As a side note, when it comes to user agent IP address, we're not going to use them in this project.

28
00:01:51,760 --> 00:01:57,760
I just want to showcase where you can get them on our request and write off their IP.

29
00:01:58,120 --> 00:02:00,900
I also want to set up user agent.

30
00:02:00,910 --> 00:02:05,170
So essentially, what device is accessing our project?

31
00:02:05,690 --> 00:02:07,990
Then we also want to set up is valid.

32
00:02:07,990 --> 00:02:09,340
So let's copy and paste.

33
00:02:10,060 --> 00:02:11,860
I'm going to just say is valid.

34
00:02:13,230 --> 00:02:16,080
Valid and it's not going to be a string.

35
00:02:17,020 --> 00:02:18,610
It is going to be a billion.

36
00:02:19,600 --> 00:02:23,740
And like I said, I also want to set it up with a user.

37
00:02:23,890 --> 00:02:26,860
I want to reference the user and we already know the drill.

38
00:02:26,860 --> 00:02:32,770
So in order to speed this up, let's just go somewhere where we are doing that.

39
00:02:33,250 --> 00:02:34,480
Let's just copy and paste.

40
00:02:34,600 --> 00:02:36,700
I really don't see the point of where you typing that.

41
00:02:37,450 --> 00:02:39,360
So let's grab this one token.

42
00:02:39,400 --> 00:02:39,970
Yes.

43
00:02:40,210 --> 00:02:44,240
OK, we're setting this up with a user now and then.

44
00:02:44,440 --> 00:02:50,110
We also want to set up timestamps, time stamps and set it equal to true.

45
00:02:50,650 --> 00:02:52,990
Last but not least, you want to export.

46
00:02:53,320 --> 00:03:02,900
So let's go here with the module that exports, that is equal to my wish line model and set it up as

47
00:03:02,900 --> 00:03:06,550
a token comma and then token schema.

48
00:03:07,210 --> 00:03:15,730
And with this in place now, we can start slowly refactoring our code in the auth controller.

