-
Урок 1.
00:03:18
What is GraphQL
-
Урок 2.
00:06:11
GraphQL Prevents Over-Fetching
-
Урок 3.
00:04:04
GraphQL Prevents Under-Fetching
-
Урок 4.
00:03:36
How Data is Organized
-
Урок 5.
00:02:39
Local Environment Setup
-
Урок 6.
00:15:25
Setting up a GraphQL Server
-
Урок 7.
00:08:31
GraphQL Scalar Types
-
Урок 8.
00:04:42
GraphQL Array Types
-
Урок 9.
00:02:16
Nodemon for Hot Reloading
-
Урок 10.
00:06:39
GraphQL Object Types
-
Урок 11.
00:02:54
Querying an Array of Objects
-
Урок 12.
00:08:32
Querying One Object with Variables
-
Урок 13.
00:11:01
Queries for Categories
-
Урок 14.
00:10:13
Relating Data (One to Many)
-
Урок 15.
00:06:21
Relating Data (Many to One)
-
Урок 16.
00:09:00
Reorganizing for a Better File Structure
-
Урок 17.
00:06:00
The Context Param
-
Урок 18.
00:09:06
Adding the Ability to Query for Reviews
-
Урок 19.
00:11:26
Filtering and Input Type
-
Урок 20.
00:11:19
Filter by Average Rating
-
Урок 21.
00:03:13
Intro to Mutations
-
Урок 22.
00:07:16
Creating Data - Part I
-
Урок 23.
00:13:23
Creating Data - Part II
-
Урок 24.
00:15:41
Deleting Data (with Set Null) - Part I
-
Урок 25.
00:06:54
Deleting Data (with Delete Cascade) - Part II
-
Урок 26.
00:02:27
Deleting Data - Part III
-
Урок 27.
00:09:16
Updating Data - Part I
-
Урок 28.
00:08:19
Updating Data - Part II
-
Урок 29.
00:09:57
Introduction to GraphQL Design
-
Урок 30.
00:08:36
A Naive Implementation
-
Урок 31.
00:03:11
Rule 1 - Start with a High Level View of the Objects and Their Relationships
-
Урок 32.
00:02:34
Rule 2 - Never Expose Implementation Details
-
Урок 33.
00:03:22
Rule 3 - Design your API Around your Business Domain
-
Урок 34.
00:03:01
Rule 4 - It's Easier to Add Fields than to Remove Them
-
Урок 35.
00:02:45
Rule 5 - Group Closely-Related Fields Together into Sub-Objects
-
Урок 36.
00:03:34
Rule 6 - Always Check if a List Should be Paginated
-
Урок 37.
00:01:50
Rule 7 - Always use Object References Instead of ID Fields
-
Урок 38.
00:01:13
Rule 8 - Choose Field Names Based on What Makes Sense, Not the Implementation
-
Урок 39.
00:01:45
Rule 9 - Use Enums for Fields that can Only Take a Specific Set of Values
-
Урок 40.
00:03:05
Rule 10 - Your API Should Provide Business Logic, Not Just Data
-
Урок 41.
00:02:19
Rule 11 - Write Separate Mutations for Separate Logical Actions on a Resource
-
Урок 42.
00:01:36
Rule 12 - For Relationship Mutations Consider Operating on Multiple Elements
-
Урок 43.
00:05:34
Rule 13 - Prefix Mutation Names with the Object for Alphabetical Grouping
-
Урок 44.
00:04:04
Rule 14 - Structure Mutation Inputs to Reduce Duplication
-
Урок 45.
00:03:13
Rule 15 - Mutations Should Provide User/Business Level Errors
-
Урок 46.
00:05:38
A New Project
-
Урок 47.
00:04:50
A Little About TypeScript
-
Урок 48.
00:07:52
Setting up TypeScript
-
Урок 49.
00:09:57
Setting up an Apollo Server
-
Урок 50.
00:06:41
A Little About SQL Databases
-
Урок 51.
00:05:14
Spinning up a Postgres Instance
-
Урок 52.
00:06:37
Connecting to Our Database with Prisma
-
Урок 53.
00:10:38
Creating a Database Schema
-
Урок 54.
00:09:07
Adding Entity Relationships
-
Урок 55.
00:21:38
Defining Our GraphQL Schema
-
Урок 56.
00:09:28
Creating Data with Prisma
-
Урок 57.
00:05:04
Retrieving Data with Prisma
-
Урок 58.
00:21:17
Updating Data with Prisma
-
Урок 59.
00:06:19
Deleting Data with Prisma
-
Урок 60.
00:03:37
What is Authentication & Authorization
-
Урок 61.
00:11:37
A Naive Signup Implementation
-
Урок 62.
00:11:36
Validating the Inputs
-
Урок 63.
00:15:16
Password Hashing
-
Урок 64.
00:12:36
Json Web Tokens
-
Урок 65.
00:02:12
Creating a User Profile
-
Урок 66.
00:12:44
Adding the Sign In Mutation
-
Урок 67.
00:13:22
Identifying Users with JWT
-
Урок 68.
00:10:39
Authorizing Users with JWT
-
Урок 69.
00:07:11
Adding Publish/Unpublish Logic
-
Урок 70.
00:05:20
The Me Query
-
Урок 71.
00:08:49
The Profile Query
-
Урок 72.
00:11:39
Relational Post Queries
-
Урок 73.
00:07:47
The N + 1 Problem
-
Урок 74.
00:05:55
Batching and Catching Queries
-
Урок 75.
00:13:43
Adding a DataLoader to Improve Performace
-
Урок 76.
00:04:25
Introduction to Client Connect
-
Урок 77.
00:05:51
Connect the Client to GraphQL with Apollo Client
-
Урок 78.
00:11:47
Querying From the Frontend
-
Урок 79.
00:10:47
Querying with Variables
-
Урок 80.
00:03:21
Conditional Rendering Based on Authentication Status
-
Урок 81.
00:06:50
Passing the Auth Token From the Frontend
-
Урок 82.
00:13:25
Executing Mutations From the Frontend
-
Урок 83.
00:17:54
Adding Signin/Signup Logic
-
Урок 84.
00:10:39
Adding Logic to Create a Post
-
Урок 85.
00:00:49
The Last Steps
Actually, I can't figure out as to why the author creates a new file canUserMutatePost.ts.
All we need to know is
1) postId which is already implemented in postResolvers.ts
2) authorId who created the post the value of which we take from his JWT Token.
The rest Prisma (or a postgres to be exact ) will do for us. There can't be a post with an authorId who didn't create the post.
Therefore we change
await prisma.post.findUnique({ where: {id: +postId} })
to
await prisma.post.findFirst({ where: { AND: [{id: +postId }, {authorId: userId}] } })
If a user with a different token tries to delete a post which doesn't belong to his userId - it will return a userErrors.
There is only one reason to create a separate logic is that you want to reveal a user the actual error. To my mind it's unnecessary.
Respect conciseness!
What's the point I can't get it? What does it mean an optional profile and why he says it's a one-to-many relationship if a user can basically have one profile only meaning it must be a one-to-one relationship! He doesn't explain anything... I've just started to listen to the lesson once again at the 0:23 he says ONE-TO-ONE relationship (logically it's correct). Then, I even decided to switch on subtitles since English is a foreign language for me. Nevertheless I clearly hear and now read he says WE WANT TO HAVE (I was dubious about initially for I'd been thinking he must have said WE WON'T HAVE - subtitles show the same as I hear.
Okay, uniqueness I get it. I went to the [docs](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/one-to-many-relations), found a piece of explanation:
> **Comparing one-to-one and one-to-many relations**
> In relational databases, the main difference between a 1-1 and a 1-n-relation is that in a 1-1-relation the foreign key must have a UNIQUE constraint defined on it.
There must be only one user id as a foreign key in a Profile.
What about Profile? How a profile might be undefined? If you create a user a profile is created simultaneously or do I miss something? ¯\_(ツ)_/¯
```
model User {
id Int @id @default(autoincrement())
emai String @unique
name String?
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
posts Post[]
profile Profile?
}
model Profile {
id Int @id @default(autoincrement())
bio String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fileds: [userId], references: [id])
userId Int @unique
}
```
#update: While typing all of this, I went to the [docs](https://www.prisma.io/docs/concepts/components/prisma-schema/relations/one-to-one-relations), now I see where the example is taken from
Well, I haven't seen the implementation in which a user exists, but a profile is optional. That's what confused me.
If you're a proficient developer give me a hand.... if you know....
In the 55-th lesson he assign a decorator @unique to userId and create a new field profile with an optional Profile? type;
What's the point I can't get it. What does it mean an optional profile and why he said it's a one-to-many relationship if a user can basically have one profile only meaning it must be a one-to-one relationship! He doesn't explain anything.... ¯\_(ツ)_/¯
model User {
id Int @id @default(autoincrement())
emai String @unique
name String?
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
posts Post[]
profile Profile?
}
model Profile {
id Int @id @default(autoincrement())
bio String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fileds: [userId], references: [id])
userId Int @unique
}
Here's a solution for Windows Users I've published in the author repo:
https://github.com/harblaith7/GraphQL-Course-Udemy/issues/1
https://github.com/harblaith7/GraphQL-Course-Udemy/issues/2