Radim Štěpaník
Text
ORCHESTR
ORCHESTR
Radim Štěpaník
Text
ORCHESTR
ORCHESTR
Radim Štěpaník
Text
ORCHESTR
ORCHESTR
👀 CTO
🎤 Moderátor
🎸 Kytarista
👨👧 Rodič
(snad lepší než kytarista)
🎧 Listen on spotify
🐦 Follow me on twitter
kinapets
QCAST
User
Review
Product
String
Int
Boolean
name!
user!
product
isConfirmed
product
reviews
url!
me
products!
boughtProducts
type Product {
id: ID!
url: String!
reviews: [Review]
}
type Review {
id: ID!
user: User
product: Product!
isConfirmed: Boolean
}
type User {
id: ID!
name: String
}
type Query {
product(id: ID!): Product
products(url: String!): [Product!]!
me: User
}
GET /v1/products
GET /v1/products/{id}
# reviews vrací pouze referenci na uživatele
GET /v1/products/{id}/reviews
GET /v1/users/{id}
type Product {
id: ID!
url: String!
reviews: [Review]
}
type Review {
id: ID!
user: User
product: Product!
isConfirmed: Boolean
}
type User {
id: ID!
name: String
}
type Query {
product(id: ID!): Product
products(url: String!): [Product!]!
me: User
}
// List of products with badges
// of users who created review
{
products {
id
url
reviews {
users {
name
}
}
}
}
// List of products with badges
// of users who created review
{
products {
id
url
reviews {
users {
name
}
}
}
}
// Step one - get products
GET /v1/products?url=tv
// Step two - load reviews for product
GET /v1/reviews?productId=1
GET /v1/reviews?productId=2
GET /v1/reviews?productId=3
// Step three load users
GET /v1/users/1
GET /v1/users/2
GET /v1/users/1
GET /v1/users/3
Product
User
String
description
creator
User
Review
Product
String
Int
Boolean
name!
user!
product
isConfirmed
product
reviews
url!
me
products!
boughtProducts
User team
Product team
type Product {
id: ID!
url: String!
reviews: [Review]
}
type Review {
id: ID!
user: User
product: Product!
isConfirmed: Boolean
}
type User {
id: ID!
name: String
}
type Query {
product(id: ID!): Product
products(url: String!): [Product!]!
me: User
}
# User Subgraph Schema
type User @key(fields: "id") {
id: ID!
name: String
reviews: [Review] @shareable
}
type Review @key(fields: "id") {
id: ID!
user: User! @shareable
isConfirmed: Boolean
product: Product @external
}
extend type Product @key(fields: "id") {
id: ID! @external
}
type Query {
me: User
}
# Product Subgraph Schema
type Product @key(fields: "id") {
id: ID!
url: String!
reviews: [Review] @shareable
}
extend type Review @key(fields: "id") {
id: ID! @external
product: Product! @shareable
}
type Query {
product(id: ID!): Product
products(url: String!): [Product!]!
}
type Product {
id: ID!
url: String!
title: String!
estimatedDelivery: EstimatedDelivery!
}
// query
{
products {
id
title
estimatedDelivery {
...
}
}
}
🥳 Dataloader
Don't do them
Deprecate value with a directive
Monitor the usage
type Category {
id: ID!
imageId: Int @deprecated(reason: "ImageId property is renamed to mediaId")
mediaId: Int
}