-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from fernando-apollo/main
WIP connectors module and module reset
- Loading branch information
Showing
58 changed files
with
3,087 additions
and
357 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
extend schema | ||
@link( | ||
url: "https://specs.apollo.dev/federation/v2.10" | ||
import: ["@key", "@tag", "@shareable"] | ||
) | ||
@link( | ||
url: "https://specs.apollo.dev/connect/v0.1" | ||
import: ["@connect", "@source"] | ||
) | ||
@source( | ||
name: "api" | ||
http: { baseURL: "https://rest-api-j3nprurqka-uc.a.run.app/api" } | ||
) | ||
|
||
type Query { | ||
""" | ||
Get a specific order by id. Meant to be used for a detailed view of an order | ||
""" | ||
order(id: ID!): Order | ||
@connect( | ||
source: "api" | ||
http: { GET: "/orders/{$args.id}" } | ||
selection: """ | ||
id | ||
buyer: { id: $.customerId } | ||
items: $.variantIds { id: $ } | ||
""" | ||
entity: true | ||
) | ||
} | ||
|
||
""" | ||
Returns information about a specific purchase | ||
""" | ||
type Order @key(fields: "id") { | ||
""" | ||
Each order has a unique id which is separate from the user or items they bought | ||
""" | ||
id: ID! | ||
|
||
""" | ||
The user who made the purchase | ||
""" | ||
buyer: User! | ||
|
||
""" | ||
A list of all the items they purchased. This is the Variants, not the Products so we know exactly which | ||
product and which size/color/feature was bought | ||
""" | ||
items: [ProductVariant!]! | ||
} | ||
|
||
type User @key(fields: "id") { | ||
id: ID! | ||
} | ||
|
||
type ProductVariant @key(fields: "id", resolvable: false) { | ||
id: ID! | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
extend schema | ||
@link( | ||
url: "https://specs.apollo.dev/federation/v2.8" | ||
import: ["@key", "@tag", "@shareable", "@authenticated", "@requiresScopes"] | ||
) | ||
|
||
type Query { | ||
""" | ||
Get a specific order by id. Meant to be used for a detailed view of an order | ||
""" | ||
order(id: ID!): Order @authenticated | ||
} | ||
|
||
""" | ||
Returns information about a specific purchase | ||
""" | ||
type Order @key(fields: "id") { | ||
""" | ||
Each order has a unique id which is separate from the user or items they bought | ||
""" | ||
id: ID! | ||
|
||
""" | ||
The user who made the purchase | ||
""" | ||
buyer: User! @requiresScopes(scopes: [["order:buyer"]]) | ||
|
||
""" | ||
A list of all the items they purchased. This is the Variants, not the Products so we know exactly which | ||
product and which size/color/feature was bought | ||
""" | ||
items: [ProductVariant!]! @requiresScopes(scopes: [["order:items"]]) | ||
} | ||
|
||
type User @key(fields: "id") { | ||
id: ID! | ||
} | ||
|
||
type ProductVariant @key(fields: "id", resolvable: false) { | ||
id: ID! | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Configuration of the router's HTTP server | ||
# Default configuration for container | ||
supergraph: | ||
# The socket address and port to listen on | ||
listen: 0.0.0.0:${env.PORT:-4000} | ||
introspection: true | ||
|
||
# For demo purposes - can remove or enable homepage | ||
sandbox: | ||
enabled: true | ||
homepage: | ||
enabled: false | ||
|
||
cors: | ||
origins: | ||
- https://studio.apollographql.com | ||
allow_credentials: true | ||
|
||
# This would make debugging easier, but should be a per subgraph basis for production | ||
include_subgraph_errors: | ||
all: true # Propagate errors from all subgraphs | ||
|
||
subscription: | ||
enabled: true | ||
mode: | ||
passthrough: | ||
# docker setup, for local setup comment out the following section | ||
subgraphs: | ||
products: | ||
path: / | ||
|
||
## Enter Workshop Module Configs Below | ||
## Authentication and Authorization Module | ||
authentication: | ||
router: | ||
jwt: | ||
header_name: Authorization | ||
header_value_prefix: Bearer | ||
jwks: | ||
- url: https://www.googleapis.com/service_accounts/v1/jwk/[email protected] | ||
|
||
authorization: | ||
require_authentication: false | ||
preview_directives: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
extend schema | ||
@link(url: "https://specs.apollo.dev/federation/v2.8", import: | ||
[ | ||
"@key", | ||
"@requires", | ||
"@external", | ||
"@tag", | ||
"@shareable" | ||
] | ||
) | ||
|
||
type Query { | ||
users: [User] | ||
user(id: ID!): User | ||
} | ||
|
||
""" | ||
An user account in our system | ||
""" | ||
type User @key(fields: "id") { | ||
id: ID! | ||
|
||
firstName: String @tag(name: "private") | ||
lastName: String @tag(name: "private") | ||
address: String @tag(name: "private") | ||
phone: String | ||
@tag(name: "private") | ||
@shareable | ||
email: String! | ||
@tag(name: "private") | ||
@shareable | ||
|
||
""" | ||
The user's active cart session. Once the cart items have been purchases, they transition to an Order | ||
""" | ||
activeCart: Cart | ||
|
||
""" | ||
The users previous purchases | ||
""" | ||
orders(filters: OrderFilters): [Order] | ||
|
||
paymentMethods: [PaymentMethod] | ||
} | ||
|
||
""" | ||
Search filters for when showing an users previous purchases | ||
""" | ||
input OrderFilters { | ||
orderId: ID! | ||
priceHigh: Float | ||
priceLow: Float | ||
itemsInOrder: Int | ||
} | ||
|
||
""" | ||
An user's saved cart session. Only one cart can be active at a time | ||
""" | ||
type Cart @key(fields: "owner { id }") { | ||
""" | ||
Owner of the cart session | ||
""" | ||
owner: User! | ||
""" | ||
Items saved in the cart session | ||
""" | ||
items: [ProductVariant] | ||
subtotal: Float! @requires(fields: "items { price }") | ||
} | ||
|
||
type Order @key(fields: "id", resolvable: false) { | ||
id: ID! | ||
} | ||
|
||
type ProductVariant @key(fields: "id", resolvable: false) { | ||
id: ID! | ||
price: Float! @external | ||
} | ||
|
||
type PaymentMethod { | ||
id: ID! | ||
cardNumber: String! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.