0:00 So thanks to this ts config path, we can now utilize our new 0:03 library with this simple import. 0:06 Let's go ahead and do this next by creating our first GraphQL 0:11 entity inside of Jobber Auth. 0:14 In here, in our source directory, I'll go ahead and create a new 0:18 folder, 0:19 and I want to call this folder Users, since it's gonna 0:23 contain all of our user-related code. 0:26 Now, inside of Users, let's create a new 0:30 Models folder, which is gonna contain all of our GraphQL 0:34 entities 0:35 for users. 0:36 Now finally, inside of Models, we'll create our first user 0:40 model.ts. 0:42 So now, thanks to our abstract type, this is gonna be very easy. 0:45 We simply create a new class called User 0:49 that's going to extend our abstract model. 0:54 Now, in order to define the import here, well, we know from 0:58 our TS config base that we can import 1:01 this abstract model 1:04 from our alias here of 1:06 @jobber/nestjs. 1:10 And now in here, we already have the ID property declared. 1:13 The only other property that I want to expose externally on our 1:16 GraphQL server is the email of the user. 1:21 I do not want the password to be queryable because that is a 1:25 security flaw. We don't want to expose the password on 1:28 this 1:28 user to outside world. We wanna keep that locked down. 1:33 However, emails can be queried on the user. 1:36 So we'll decorate this with the @field decorator to mark it as 1:39 part of the schema. 1:41 And then finally, we'll decorate this model with the object 1:45 type 1:45 decorator to mark it as a GraphQL type and add it to our 1:49 schema. 1:51 So at this point, we're finally ready to add a new 1:54 resolver to our Users folder. Now, in 1:58 GraphQL, resolvers are essentially the equivalent of a 2:01 controller 2:02 in Nestjs. They are the entry point to GraphQL
The rest of the transcript is for members.
Sign in