Skip to content

Commit

Permalink
add typedefs
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Sep 9, 2021
1 parent 0f14557 commit abf1284
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/store-api/src/typeDefs/aggregateOffer.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type StoreAggregateOffer {
# Highest spot price amongst all sellers
highPrice: Float!
# Lowest spot price amongst all sellers
lowPrice: Float!
# Number of sellers selling this sku
offerCount: Int!
priceCurrency: String!
offers: [StoreOffer!]!
}
4 changes: 4 additions & 0 deletions packages/store-api/src/typeDefs/aggregateRating.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type StoreAggregateRating {
ratingValue: Float!
reviewCount: Int!
}
3 changes: 3 additions & 0 deletions packages/store-api/src/typeDefs/author.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type StoreAuthor {
name: String!
}
3 changes: 3 additions & 0 deletions packages/store-api/src/typeDefs/brand.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type StoreBrand {
name: String!
}
10 changes: 10 additions & 0 deletions packages/store-api/src/typeDefs/breadcrumb.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type StoreListItem {
item: String!
name: String!
position: Int!
}

type StoreBreadcrumbList {
itemListElement: [StoreListItem!]!
numberOfItems: Int!
}
26 changes: 26 additions & 0 deletions packages/store-api/src/typeDefs/collection.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
enum StoreCollectionType {
Department
Category
Brand
Cluster
}

type StoreCollectionFacet {
key: String!
value: String!
}

type StoreCollectionMeta {
selectedFacets: [StoreCollectionFacet!]!
}

type StoreCollection {
# Meta tag data
seo: StoreSeo!
# location for structured data
breadcrumbList: StoreBreadcrumbList!
meta: StoreCollectionMeta!
id: ID!
slug: String!
type: StoreCollectionType!
}
14 changes: 14 additions & 0 deletions packages/store-api/src/typeDefs/facet.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type StoreFacet {
key: String!
label: String!
values: [StoreFacetValue!]!
type: StoreFacetType!
}

type StoreFacetValue {
value: String!
label: String!
selected: Boolean!
# Number of items with this facet
quantity: Int!
}
4 changes: 4 additions & 0 deletions packages/store-api/src/typeDefs/image.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type StoreImage {
url: String!
alternateName: String!
}
39 changes: 39 additions & 0 deletions packages/store-api/src/typeDefs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { print } from 'graphql'

import AggregateOffer from './aggregateOffer.graphql'
import AggregateRating from './aggregateRating.graphql'
import Author from './author.graphql'
import Brand from './brand.graphql'
import Breadcrumb from './breadcrumb.graphql'
import Collection from './collection.graphql'
import Facet from './facet.graphql'
import Image from './image.graphql'
import Offer from './offer.graphql'
import Organization from './organization.graphql'
import PageInfo from './pageInfo.graphql'
import Product from './product.graphql'
import ProductGroup from './productGroup.graphql'
import Query from './query.graphql'
import Review from './review.graphql'
import Seo from './seo.graphql'

export const typeDefs = [
Query,
Brand,
Breadcrumb,
Collection,
Facet,
Image,
PageInfo,
Product,
Seo,
Offer,
AggregateRating,
Review,
Author,
ProductGroup,
Organization,
AggregateOffer,
]
.map(print)
.join('\n')
11 changes: 11 additions & 0 deletions packages/store-api/src/typeDefs/offer.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type StoreOffer {
listPrice: Float!
sellingPrice: Float!
priceCurrency: String!
# Also known as spotPrice
price: Float!
priceValidUntil: String!
itemCondition: String!
availability: String!
seller: StoreOrganization!
}
3 changes: 3 additions & 0 deletions packages/store-api/src/typeDefs/organization.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type StoreOrganization {
identifier: String!
}
8 changes: 8 additions & 0 deletions packages/store-api/src/typeDefs/pageInfo.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type StorePageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String!
endCursor: String!
# Total number of items, not pages
totalCount: Int!
}
19 changes: 19 additions & 0 deletions packages/store-api/src/typeDefs/product.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type StoreProduct {
# Meta tag data
seo: StoreSeo!
# location for structured data
breadcrumbList: StoreBreadcrumbList!
# Where to retrieve this entity
slug: String!
name: String!
productID: String!
brand: StoreBrand!
description: String!
image: [StoreImage!]!
offers: StoreAggregateOffer!
sku: String!
gtin: String!
review: [StoreReview!]!
aggregateRating: StoreAggregateRating!
isVariantOf: StoreProductGroup!
}
5 changes: 5 additions & 0 deletions packages/store-api/src/typeDefs/productGroup.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type StoreProductGroup {
hasVariant: [StoreProduct!]!
productGroupID: String!
name: String!
}
72 changes: 72 additions & 0 deletions packages/store-api/src/typeDefs/query.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
type StoreProductEdge {
node: StoreProduct!
cursor: String!
}

type StoreProductConnection {
pageInfo: StorePageInfo!
edges: [StoreProductEdge!]!
}


type StoreCollectionEdge {
node: StoreCollection!
cursor: String!
}

type StoreCollectionConnection {
pageInfo: StorePageInfo!
edges: [StoreCollectionEdge!]!
}

enum StoreProductIDField {
id
slug
}

input StoreProductID {
field: StoreProductIDField!
value: ID!
}

enum StoreSort {
price_desc
price_asc
orders_desc
name_desc
name_asc
release_desc
discount_desc
score_desc
}

input StoreSelectedFacet {
key: String!
value: String!
}

enum StoreFacetType {
BOOLEAN
RANGE
}

type StoreSearchResult {
products: StoreProductConnection!
facets: [StoreFacet!]!
}

type Query {
product(locator: StoreProductID!): StoreProduct!

search(
first: Int!
after: String
sort: StoreSort = score_desc
term: String = ""
selectedFacets: [StoreSelectedFacet!]
): StoreSearchResult!

allProducts(first: Int!, after: String): StoreProductConnection!

allCollections(first: Int!, after: String): StoreCollectionConnection!
}
9 changes: 9 additions & 0 deletions packages/store-api/src/typeDefs/review.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type StoreReviewRating {
ratingValue: Float!
bestRating: Float!
}

type StoreReview {
reviewRating: StoreReviewRating!
author: StoreAuthor!
}
6 changes: 6 additions & 0 deletions packages/store-api/src/typeDefs/seo.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type StoreSeo {
title: String!
titleTemplate: String!
description: String!
canonical: String!
}

0 comments on commit abf1284

Please sign in to comment.