1
00:00:00,570 --> 00:00:07,890
And once our earth is working now, essentially, we want to set up a model or a job and of course,

2
00:00:07,890 --> 00:00:09,670
work on the rest of the world.

3
00:00:10,080 --> 00:00:14,480
Now, before we set up the model dome, let me also quickly say it.

4
00:00:14,910 --> 00:00:17,170
So this is going to be create jobs.

5
00:00:17,880 --> 00:00:20,370
So let's set up the name create.

6
00:00:21,400 --> 00:00:28,600
Job and, of course, austerity in the jobs one, and I also want to test it out really quickly where

7
00:00:28,630 --> 00:00:36,100
if in a head I make that mistake and I don't have the space, what response I get, of course I have

8
00:00:36,400 --> 00:00:37,920
authentication error.

9
00:00:38,320 --> 00:00:42,610
So, again, this just proves the point that I was making before essentially here.

10
00:00:42,610 --> 00:00:46,420
And if we all met the space over here, we still check the token.

11
00:00:46,760 --> 00:00:51,400
And of course, in that case, we're not able to split it, meaning we are splitting it, but we're

12
00:00:51,400 --> 00:00:52,540
just getting on the phone.

13
00:00:52,810 --> 00:00:56,920
And as a result, our token is undefined as well.

14
00:00:57,130 --> 00:00:58,660
So hopefully that is clear.

15
00:00:58,960 --> 00:01:03,760
So now let me just navigate to the models and I want to create a job model.

16
00:01:04,000 --> 00:01:06,850
And the first thing that I want to do is set up the Mangoush.

17
00:01:07,300 --> 00:01:09,610
And of course, that is equal to acquire.

18
00:01:10,270 --> 00:01:12,940
And we're looking for a package, Raimondo's one.

19
00:01:13,330 --> 00:01:15,520
And after that, let's just set up our schema.

20
00:01:15,580 --> 00:01:19,470
So let me close the sidebar just so we have a little bit more real estate.

21
00:01:19,780 --> 00:01:27,240
So job schema, and that is equal to new Mangoush and schema schema.

22
00:01:27,550 --> 00:01:29,500
And here let's passing the object.

23
00:01:29,830 --> 00:01:33,040
And as far as the properties, I'm going to have the company.

24
00:01:34,300 --> 00:01:43,300
And I will be equal to an object of type will be set, the string of required will be true and we will

25
00:01:43,300 --> 00:01:47,070
set it up as an array, of course, and let's just say true.

26
00:01:47,560 --> 00:01:55,030
And as far as the message will go with please provide company and name.

27
00:01:55,330 --> 00:02:01,600
And the last thing that I want to set up for the company is max length that we can use on strings.

28
00:02:02,170 --> 00:02:05,810
And in here we'll set it up as 50.

29
00:02:06,250 --> 00:02:09,680
Of course, if you want to go with different value, be my guest.

30
00:02:10,060 --> 00:02:14,980
So let me take the company and I'll copy and paste this one one time.

31
00:02:15,280 --> 00:02:19,090
And the second property we want to set up is the position.

32
00:02:20,290 --> 00:02:26,680
It's going to be a string again, will be required and in this case, of course, will say position,

33
00:02:27,010 --> 00:02:33,340
please provide position as far as the max length in this case, let's maybe increase it.

34
00:02:33,730 --> 00:02:35,320
In my case, I'm going to go to hundred.

35
00:02:35,740 --> 00:02:42,460
And then as far as the job interview, well, there's always the status, whether it's pending or whether

36
00:02:42,460 --> 00:02:48,070
we're waiting for a response, whether we already have the interview or it was the client.

37
00:02:48,070 --> 00:02:48,510
Correct.

38
00:02:49,340 --> 00:02:55,010
And essentially, we want to do that using the status properly, so karma status.

39
00:02:55,490 --> 00:02:58,250
And again, it's going to be an object.

40
00:02:58,580 --> 00:03:05,300
It's going to be a string, but we'll use that enum remember option where we can set up the array with

41
00:03:05,300 --> 00:03:06,400
a possible virus.

42
00:03:06,410 --> 00:03:07,490
So let's say here.

43
00:03:07,490 --> 00:03:13,970
ENUM And as far as possible values, like I said, we'll go with interview and declined.

44
00:03:14,840 --> 00:03:15,800
Declined.

45
00:03:16,920 --> 00:03:22,790
And then the last one will be pending and this is going to be the case again, we're on the front end,

46
00:03:23,160 --> 00:03:29,540
we'll just provide at least two hours of company one and position when we are creating the job.

47
00:03:30,120 --> 00:03:32,560
So these are going to be the values that are required.

48
00:03:32,940 --> 00:03:41,060
However, the status one we will manipulate when we are modifying the job, so therefore will go status.

49
00:03:41,110 --> 00:03:42,150
These are our options.

50
00:03:42,450 --> 00:03:47,160
And then, like I said, lastly, we'll go default and set it equal to pending.

51
00:03:47,490 --> 00:03:49,140
That's the set up I'm going to have.

52
00:03:49,410 --> 00:03:56,910
And then probably the most most important property that we haven't set up is the created by Y.

53
00:03:57,300 --> 00:04:04,590
Well, because in here we'll tie our job to the actual user and the way it's going to look like we'll

54
00:04:04,590 --> 00:04:11,760
go here with created by again the name is really up to you, but that's set up that I have created by

55
00:04:11,940 --> 00:04:20,070
and then type is not going to be string or a number fact, it's going to be a Mongo's types and then

56
00:04:20,070 --> 00:04:22,550
we're looking for object and.

57
00:04:23,340 --> 00:04:24,630
This is very, very important.

58
00:04:24,930 --> 00:04:29,630
So essentially now we're tying our job model to the user one.

59
00:04:29,820 --> 00:04:32,640
So we have the user model over here.

60
00:04:32,790 --> 00:04:33,240
Correct.

61
00:04:33,480 --> 00:04:35,160
So this is where we're creating user.

62
00:04:35,430 --> 00:04:40,740
So every time we'll create a job, we will assign it to one of the users.

63
00:04:41,340 --> 00:04:47,340
And as a result, of course, our functionality will work because every job that we will create will

64
00:04:47,340 --> 00:04:49,800
be associated with a user.

65
00:04:49,950 --> 00:04:55,500
So first we have a type and we need to go mongoose types and then object ID.

66
00:04:55,800 --> 00:04:57,570
That's going to be the type for a property.

67
00:04:57,900 --> 00:05:04,110
And then we need to go rough and we need to specifically say, well, which model are we referencing?

68
00:05:04,380 --> 00:05:06,730
And in this case we'll go with user, of course.

69
00:05:07,020 --> 00:05:10,850
So I want to tie the job to the user.

70
00:05:11,130 --> 00:05:12,210
Hopefully that is clear.

71
00:05:12,210 --> 00:05:17,550
And then of course, we want to go with a required as well because we don't want to create a job without

72
00:05:17,550 --> 00:05:19,920
a user, set it equal to zero.

73
00:05:20,290 --> 00:05:25,970
And as far as the value, again, we just go please provide an user.

74
00:05:26,400 --> 00:05:27,420
And then lastly.

75
00:05:28,400 --> 00:05:35,680
Right after the scheme object, the first option that we have over here, I want to go with karma and

76
00:05:35,680 --> 00:05:43,070
we'll set up timestamps, Andrew, and I'll showcase them once we actually start sending request from

77
00:05:43,070 --> 00:05:48,820
the postman, because you'll see the benefit of using timestamps right in the response.

78
00:05:48,830 --> 00:05:50,480
So don't worry about them for now.

79
00:05:50,780 --> 00:05:53,440
I'll show you once we start getting back the responses.

80
00:05:53,810 --> 00:06:00,320
And of course, eventually what we want to do is just go with module exports and we want a set of equal

81
00:06:00,320 --> 00:06:04,400
to Mongo's van model and line.

82
00:06:04,400 --> 00:06:11,140
As far as the name, I'm just going to go with job and then we'll pass in the job schema.

83
00:06:11,420 --> 00:06:15,890
And once we have all of this in place now, of course, we can focus on the route.

84
00:06:16,130 --> 00:06:18,950
And I guess let's start with the create job one.

