The video demonstrates managing database relationships and CRUD operations using NestJS, TypeORM, and MySQL. It covers viewing auto-generated tables, managing user roles via join tables in Postman, and updating backend code to populate entity relations. The session concludes with testing reservation operations including creation, modification, and deletion.
Length 5:39
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #nest.js #typeorm #mysql #microservices #crud #postman #api #database #backend #coding
0:00 So now let's go ahead and run Docker Compose up to start up all 0:03 of our services 0:04 and our MySQL server. So after all of our microservices have 0:08 start up, let's go back to MySQL Workbench and open 0:12 up our connection to our database. 0:15 Here we can open up our Sleeper schema, and now we can see the 0:19 auto-generated tables that TypeORM in NestJS has 0:22 created for us. We can start off by right-clicking the 0:25 reservation 0:26 tables and listing out the schema here, where we can see all 0:30 of our schema and all the properties that exist on our reservation with 0:34 no data yet. 0:36 We can do the same thing for a user. So if we select rows on a user, 0:40 we see our ID, email, and password. 0:43 We don't see any relationship to the roles, and that's because of the 0:47 many-to-many relationship we have in place. 0:50 We have a separate table here called role that 0:54 holds all of the roles. Since each role can be associated 0:58 with many different users, we keep track of the 1:01 roles here with an ID and name. And then there's a separate join 1:05 table that we specified in our code that actually maps 1:09 the user ID to that role ID, and those relationships are 1:13 held in this join table. So I've gone ahead and opened up 1:17 Postman, and let's launch a POST request at 1:20 localhost three 1:20 thousand and one, which is where our auth service 1:23 is listening for for 1:24 HTTP requests, slash users. I'll create a new 1:28 user with an email, password, and let's create a new 1:32 role. So to create a new role, we'll only provide the name, and 1:36 I'll create an admin role. So we'll go ahead and send this request. 1:40 And now we can see I have a newly created user with my
The rest of the transcript is for members.
Sign in