apollographql / apollographql/hack-the-supergraph
e-commerce schemas questions
- Dominant language
- JavaScript
- Stars
- 8
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
I was looking at the schema for users and noticed some things that can be updated:
### Cart:
```
type Cart {
"""
Items saved in the cart session
"""
items: [Product]
"""
The current total of all the items in the cart, before taxes and shipping
"""
subtotal: Float
}
```
I think we can change this to
```
type Cart {
"""
Items saved in the cart session
"""
items: [Product!]! # made this non nullable
"""
The current total of all the items in the cart, before taxes and shipping
"""
subtotal: Money! # made this money and non nullable (default could be 0 USD?)
}
```
### OrderFilters
```
input OrderFilters {
orderId: ID!
priceHigh: Float
priceLow: Float
itemsInOrder: Int
}
```
is `orderId` non-nullable on purpose?
---
There's other places where we have nullable list of nullables, I can update those to non-nullable list of non-nullables if we prefer that approach :)
### user and orders
Users shouldn't have orders inside this subgraph
```
"""
An user account in our system
"""
type User @key(fields: "id") {
id: ID!
"""
The users login username
"""
username: String!
"""
The user's active cart session. Once the cart items have been purchases, they transition to an Order
"""
cart: Cart
"""
The users previous purchases
"""
orders(filters: OrderFilters): [Order]
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names GraphQL types Cart, OrderFilters, User, and Order but provides no file paths or tests. Start by locating these schema definitions, then resolve the nullability, Money, and User/orders ownership questions with maintainers. Done means the agreed schema changes are applied and validated by the project's available checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql
- Domain
- api, backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100