Skip to content

Commit

Permalink
refactor(contentful-schema): prefix generated types with contentfulCo…
Browse files Browse the repository at this point in the history
…ntentType
  • Loading branch information
axe312ger committed May 12, 2021
1 parent 3e64579 commit e05204f
Show file tree
Hide file tree
Showing 16 changed files with 97 additions and 87 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"

export const ContentfulContentReference = ({ one, many, title }) => {
export const ContentfulContentTypeContentReference = ({ one, many, title }) => {
const references = [one, ...(many || [])].filter(Boolean)
return (
<p data-cy-id="reference">
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/contentful/src/components/references/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { ContentfulContentReference } from "./content-reference"
export { ContentfulLocation } from "./location"
export { ContentfulNumber } from "./number"
export { ContentfulText } from "./text"
export { ContentfulContentTypeContentReference } from "./content-reference"
export { ContentfulContentTypeLocation } from "./location"
export { ContentfulContentTypeNumber } from "./number"
export { ContentfulContentTypeText } from "./text"
2 changes: 1 addition & 1 deletion e2e-tests/contentful/src/components/references/location.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"

export const ContentfulLocation = ({ location }) => (
export const ContentfulContentTypeLocation = ({ location }) => (
<p data-cy-id="location">
[ContentfulLocation] Lat: {location.lat}, Long: {location.lon}
</p>
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/contentful/src/components/references/number.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"

export const ContentfulNumber = ({ integer }) => (
export const ContentfulContentTypeNumber = ({ integer }) => (
<p data-cy-id="integer">[ContentfulInteger] {integer}</p>
)
2 changes: 1 addition & 1 deletion e2e-tests/contentful/src/components/references/text.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"

export const ContentfulText = ({ short }) => (
export const ContentfulContentTypeText = ({ short }) => (
<p data-cy-id="text">[ContentfulText] {short}</p>
)
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/pages/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import slugify from "slugify"
import Layout from "../components/layout"

const BooleanPage = ({ data }) => {
const entries = data.allContentfulBoolean.nodes
const entries = data.allContentfulContentTypeBoolean.nodes
return (
<Layout>
{entries.map(({ title, boolean }) => {
Expand All @@ -25,7 +25,7 @@ export default BooleanPage

export const pageQuery = graphql`
query BooleanQuery {
allContentfulBoolean(sort: { fields: sys___id }) {
allContentfulContentTypeBoolean(sort: { fields: sys___id }) {
nodes {
title
boolean
Expand Down
40 changes: 20 additions & 20 deletions e2e-tests/contentful/src/pages/content-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function renderReferencedComponent(ref) {
}

const ContentReferencePage = ({ data }) => {
const entries = data.allContentfulContentReference.nodes
const entries = data.allContentfulContentTypeContentReference.nodes
return (
<Layout>
{entries.map(({ sys: { id }, title, one, many }) => {
Expand Down Expand Up @@ -47,7 +47,7 @@ export default ContentReferencePage

export const pageQuery = graphql`
query ContentReferenceQuery {
allContentfulContentReference(sort: { fields: title }) {
allContentfulContentTypeContentReference(sort: { fields: title }) {
nodes {
title
sys {
Expand All @@ -58,39 +58,39 @@ export const pageQuery = graphql`
sys {
id
}
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
one {
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
many {
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
Expand All @@ -101,39 +101,39 @@ export const pageQuery = graphql`
sys {
id
}
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
one {
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
many {
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
Expand Down
10 changes: 7 additions & 3 deletions e2e-tests/contentful/src/pages/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,23 @@ export default DatePage

export const pageQuery = graphql`
query DateQuery {
dateTime: contentfulDate(sys: { id: { eq: "38akBjGb3T1t4AjB87wQjo" } }) {
dateTime: contentfulContentTypeDate(
sys: { id: { eq: "38akBjGb3T1t4AjB87wQjo" } }
) {
title
date: dateTime
formatted: dateTime(formatString: "D.M.YYYY - hh:mm")
}
dateTimeTimezone: contentfulDate(
dateTimeTimezone: contentfulContentTypeDate(
sys: { id: { eq: "6dZ8pK4tFWZDZPHgSC0tNS" } }
) {
title
date: dateTimeTimezone
formatted: dateTimeTimezone(formatString: "D.M.YYYY - hh:mm (z)")
}
date: contentfulDate(sys: { id: { eq: "5FuULz0jl0rKoKUKp2rshf" } }) {
date: contentfulContentTypeDate(
sys: { id: { eq: "5FuULz0jl0rKoKUKp2rshf" } }
) {
title
date
formatted: date(formatString: "D.M.YYYY")
Expand Down
8 changes: 6 additions & 2 deletions e2e-tests/contentful/src/pages/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export default JSONPage

export const pageQuery = graphql`
query JSONQuery {
simple: contentfulJson(sys: { id: { eq: "2r6tNjP8brkyy5yLR39hhh" } }) {
simple: contentfulContentTypeJson(
sys: { id: { eq: "2r6tNjP8brkyy5yLR39hhh" } }
) {
json
}
complex: contentfulJson(sys: { id: { eq: "2y71nV0cpW9vzTmJybq571" } }) {
complex: contentfulContentTypeJson(
sys: { id: { eq: "2y71nV0cpW9vzTmJybq571" } }
) {
json
}
}
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/pages/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import slugify from "slugify"
import Layout from "../components/layout"

const LocationPage = ({ data }) => {
const entries = data.allContentfulLocation.nodes
const entries = data.allContentfulContentTypeLocation.nodes
return (
<Layout>
{entries.map(({ title, location }) => {
Expand All @@ -28,7 +28,7 @@ export default LocationPage

export const pageQuery = graphql`
query LocationQuery {
allContentfulLocation(sort: { fields: sys___id }) {
allContentfulContentTypeLocation(sort: { fields: sys___id }) {
nodes {
title
location {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/pages/media-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import slugify from "slugify"
import Layout from "../components/layout"

const MediaReferencePage = ({ data }) => {
const entries = data.allContentfulMediaReference.nodes
const entries = data.allContentfulContentTypeMediaReference.nodes
return (
<Layout>
{entries.map(({ sys: { id }, title, one, many }) => {
Expand Down Expand Up @@ -38,7 +38,7 @@ export default MediaReferencePage

export const pageQuery = graphql`
query MediaReferenceQuery {
allContentfulMediaReference(sort: { fields: title }) {
allContentfulContentTypeMediaReference(sort: { fields: title }) {
nodes {
title
sys {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/pages/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import slugify from "slugify"
import Layout from "../components/layout"

const NumberPage = ({ data }) => {
const entries = data.allContentfulNumber.nodes
const entries = data.allContentfulContentTypeNumber.nodes
return (
<Layout>
{entries.map(({ title, integer, decimal }) => {
Expand All @@ -25,7 +25,7 @@ export default NumberPage

export const pageQuery = graphql`
query NumberQuery {
allContentfulNumber(sort: { fields: sys___id }) {
allContentfulContentTypeNumber(sort: { fields: sys___id }) {
nodes {
title
integer
Expand Down
28 changes: 14 additions & 14 deletions e2e-tests/contentful/src/pages/rich-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const makeOptions = ({ assetBlockMap, entryBlockMap, entryInlineMap }) => ({
})

const RichTextPage = ({ data }) => {
const entries = data.allContentfulRichText.nodes
const entries = data.allContentfulContentTypeRichText.nodes
return (
<Layout>
{entries.map(({ id, title, richText }) => {
Expand All @@ -88,7 +88,7 @@ export default RichTextPage

export const pageQuery = graphql`
query RichTextQuery {
allContentfulRichText(sort: { fields: title }) {
allContentfulContentTypeRichText(sort: { fields: title }) {
nodes {
id
title
Expand All @@ -112,36 +112,36 @@ export const pageQuery = graphql`
id
type
}
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulLocation {
... on ContentfulContentTypeLocation {
location {
lat
lon
}
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
one {
__typename
sys {
id
}
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
one {
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
many {
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
Expand All @@ -152,23 +152,23 @@ export const pageQuery = graphql`
sys {
id
}
... on ContentfulText {
... on ContentfulContentTypeText {
title
short
}
... on ContentfulNumber {
... on ContentfulContentTypeNumber {
title
integer
}
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
one {
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
many {
... on ContentfulContentReference {
... on ContentfulContentTypeContentReference {
title
}
}
Expand Down
16 changes: 11 additions & 5 deletions e2e-tests/contentful/src/pages/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,24 @@ export default TextPage

export const pageQuery = graphql`
query TextQuery {
short: contentfulText(sys: { id: { eq: "5ZtcN1o7KpN7J7xgiTyaXo" } }) {
short: contentfulContentTypeText(
sys: { id: { eq: "5ZtcN1o7KpN7J7xgiTyaXo" } }
) {
short
}
shortList: contentfulText(sys: { id: { eq: "7b5U927WTFcQXO2Gewwa2k" } }) {
shortList: contentfulContentTypeText(
sys: { id: { eq: "7b5U927WTFcQXO2Gewwa2k" } }
) {
shortList
}
longPlain: contentfulText(sys: { id: { eq: "6ru8cSC9hZi3Ekvtw7P77S" } }) {
longPlain: contentfulContentTypeText(
sys: { id: { eq: "6ru8cSC9hZi3Ekvtw7P77S" } }
) {
longPlain {
raw
}
}
longMarkdownSimple: contentfulText(
longMarkdownSimple: contentfulContentTypeText(
sys: { id: { eq: "NyPJw0mcSuCwY2gV0zYny" } }
) {
longMarkdown {
Expand All @@ -73,7 +79,7 @@ export const pageQuery = graphql`
}
}
}
longMarkdownComplex: contentfulText(
longMarkdownComplex: contentfulContentTypeText(
sys: { id: { eq: "3pwKS9UWsYmOguo4UdE1EB" } }
) {
longMarkdown {
Expand Down
Loading

0 comments on commit e05204f

Please sign in to comment.