Skip to content

Commit

Permalink
Merge pull request #2221 from damassi/reenable-convection-stitching
Browse files Browse the repository at this point in the history
[Consignments] Reenable Convection Stitching
  • Loading branch information
damassi authored Mar 6, 2020
2 parents c6a0c9d + 2e242d6 commit a5d6b3d
Show file tree
Hide file tree
Showing 20 changed files with 368 additions and 464 deletions.
351 changes: 151 additions & 200 deletions _schema.graphql

Large diffs are not rendered by default.

337 changes: 144 additions & 193 deletions _schemaV2.graphql

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions hokusai/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
- CI_PULL_REQUEST=$CI_PULL_REQUEST
- CIRCLE_PULL_REQUEST=$CIRCLE_PULL_REQUEST
- CIRCLE_BUILD_NUM=$CIRCLE_BUILD_NUM
- ENABLE_CONSIGNMENTS_STITCHING=true
env_file: ../.env.test
depends_on:
- metaphysics-memcached
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged; yarn dump:local; git add _schema.graphql _schemaV2.graphql",
"pre-commit": "lint-staged; yarn dump-remote-schema; yarn dump:local; git add _schema.graphql _schemaV2.graphql",
"pre-push": "yarn run type-check"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/complete.queryMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -1593,4 +1593,4 @@
"69a1a26cfc06fa59ee0e7a023a52bad1": "query ForYouRefetchQuery {\n forYou: homePage {\n ...ForYou_forYou\n }\n}\n\nfragment ForYou_forYou on HomePage {\n artwork_modules: artworkModules(maxRails: -1, maxFollowedGeneRails: -1, order: [ACTIVE_BIDS, RECENTLY_VIEWED_WORKS, RECOMMENDED_WORKS, FOLLOWED_ARTISTS, RELATED_ARTISTS, FOLLOWED_GALLERIES, SAVED_WORKS, LIVE_AUCTIONS, CURRENT_FAIRS, FOLLOWED_GENES], exclude: [FOLLOWED_ARTISTS, GENERIC_GENES]) {\n id\n ...ArtworkRail_rail\n }\n artist_modules: artistModules {\n id\n ...ArtistRail_rail\n }\n fairs_module: fairsModule {\n ...FairsRail_fairs_module\n }\n}\n\nfragment ArtworkRail_rail on HomePageArtworkModule {\n title\n key\n results {\n href\n image {\n imageURL\n }\n id\n }\n context {\n __typename\n ... on HomePageRelatedArtistArtworkModule {\n __typename\n artist {\n slug\n internalID\n href\n id\n }\n basedOn {\n name\n id\n }\n }\n ... on HomePageFollowedArtistArtworkModule {\n artist {\n href\n id\n }\n }\n ... on Fair {\n href\n }\n ... on Gene {\n href\n }\n ... on Sale {\n href\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment ArtistRail_rail on HomePageArtistModule {\n id\n key\n results {\n id\n internalID\n ...ArtistCard_artist\n }\n}\n\nfragment FairsRail_fairs_module on HomePageFairsModule {\n results {\n id\n slug\n profile {\n slug\n id\n }\n name\n exhibitionPeriod\n followedArtistArtworks: filterArtworksConnection(first: 3, includeArtworksByFollowedArtists: true) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n id\n }\n otherArtworks: filterArtworksConnection(first: 3) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n id\n }\n }\n}\n\nfragment ArtistCard_artist on Artist {\n id\n slug\n internalID\n href\n name\n formattedNationalityAndBirthday\n avatar: image {\n url(version: \"small\")\n }\n artworksConnection(first: 3) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n }\n}\n",
"cf1134a1095fa998034a0a57f6bf2977": "query QueryRenderersForYouQuery {\n forYou: homePage {\n ...ForYou_forYou\n }\n}\n\nfragment ForYou_forYou on HomePage {\n artwork_modules: artworkModules(maxRails: -1, maxFollowedGeneRails: -1, order: [ACTIVE_BIDS, RECENTLY_VIEWED_WORKS, RECOMMENDED_WORKS, FOLLOWED_ARTISTS, RELATED_ARTISTS, FOLLOWED_GALLERIES, SAVED_WORKS, LIVE_AUCTIONS, CURRENT_FAIRS, FOLLOWED_GENES], exclude: [FOLLOWED_ARTISTS, GENERIC_GENES]) {\n id\n ...ArtworkRail_rail\n }\n artist_modules: artistModules {\n id\n ...ArtistRail_rail\n }\n fairs_module: fairsModule {\n ...FairsRail_fairs_module\n }\n}\n\nfragment ArtworkRail_rail on HomePageArtworkModule {\n title\n key\n results {\n href\n image {\n imageURL\n }\n id\n }\n context {\n __typename\n ... on HomePageRelatedArtistArtworkModule {\n __typename\n artist {\n slug\n internalID\n href\n id\n }\n basedOn {\n name\n id\n }\n }\n ... on HomePageFollowedArtistArtworkModule {\n artist {\n href\n id\n }\n }\n ... on Fair {\n href\n }\n ... on Gene {\n href\n }\n ... on Sale {\n href\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment ArtistRail_rail on HomePageArtistModule {\n id\n key\n results {\n id\n internalID\n ...ArtistCard_artist\n }\n}\n\nfragment FairsRail_fairs_module on HomePageFairsModule {\n results {\n id\n slug\n profile {\n slug\n id\n }\n name\n exhibitionPeriod\n image {\n url(version: \"large\")\n }\n followedArtistArtworks: filterArtworksConnection(first: 2, includeArtworksByFollowedArtists: true) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n id\n }\n otherArtworks: filterArtworksConnection(first: 2) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n id\n }\n }\n}\n\nfragment ArtistCard_artist on Artist {\n id\n slug\n internalID\n href\n name\n formattedNationalityAndBirthday\n avatar: image {\n url(version: \"small\")\n }\n artworksConnection(first: 3) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n }\n}\n",
"a20d025f689f651d4dd80e2d49b49880": "query ForYouRefetchQuery {\n forYou: homePage {\n ...ForYou_forYou\n }\n}\n\nfragment ForYou_forYou on HomePage {\n artwork_modules: artworkModules(maxRails: -1, maxFollowedGeneRails: -1, order: [ACTIVE_BIDS, RECENTLY_VIEWED_WORKS, RECOMMENDED_WORKS, FOLLOWED_ARTISTS, RELATED_ARTISTS, FOLLOWED_GALLERIES, SAVED_WORKS, LIVE_AUCTIONS, CURRENT_FAIRS, FOLLOWED_GENES], exclude: [FOLLOWED_ARTISTS, GENERIC_GENES]) {\n id\n ...ArtworkRail_rail\n }\n artist_modules: artistModules {\n id\n ...ArtistRail_rail\n }\n fairs_module: fairsModule {\n ...FairsRail_fairs_module\n }\n}\n\nfragment ArtworkRail_rail on HomePageArtworkModule {\n title\n key\n results {\n href\n image {\n imageURL\n }\n id\n }\n context {\n __typename\n ... on HomePageRelatedArtistArtworkModule {\n __typename\n artist {\n slug\n internalID\n href\n id\n }\n basedOn {\n name\n id\n }\n }\n ... on HomePageFollowedArtistArtworkModule {\n artist {\n href\n id\n }\n }\n ... on Fair {\n href\n }\n ... on Gene {\n href\n }\n ... on Sale {\n href\n }\n ... on Node {\n id\n }\n }\n}\n\nfragment ArtistRail_rail on HomePageArtistModule {\n id\n key\n results {\n id\n internalID\n ...ArtistCard_artist\n }\n}\n\nfragment FairsRail_fairs_module on HomePageFairsModule {\n results {\n id\n slug\n profile {\n slug\n id\n }\n name\n exhibitionPeriod\n image {\n url(version: \"large\")\n }\n followedArtistArtworks: filterArtworksConnection(first: 2, includeArtworksByFollowedArtists: true) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n id\n }\n otherArtworks: filterArtworksConnection(first: 2) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n id\n }\n }\n}\n\nfragment ArtistCard_artist on Artist {\n id\n slug\n internalID\n href\n name\n formattedNationalityAndBirthday\n avatar: image {\n url(version: \"small\")\n }\n artworksConnection(first: 3) {\n edges {\n node {\n image {\n url(version: \"large\")\n }\n id\n }\n }\n }\n}\n"
}
}
80 changes: 38 additions & 42 deletions src/data/convection.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
input AddAssetToConsignmentSubmissionInput {
# A unique identifier for the client performing the mutation.
clientMutationId: String
submission_id: ID!
gemini_token: String!
asset_type: String
submissionID: ID!
geminiToken: String!
assetType: String
}

# Autogenerated return type of AddAssetToConsignmentSubmission
Expand All @@ -25,6 +25,7 @@ type Asset {

# Uniq ID for this asset
id: ID!
submissionID: ID
submission_id: ID!
}

Expand All @@ -46,26 +47,26 @@ enum Category {
OTHER
}

# Autogenerated input type of CreateConsignmentSubmission
input CreateConsignmentSubmissionInput {
# Autogenerated input type of CreateSubmissionMutation
input CreateSubmissionMutationInput {
# A unique identifier for the client performing the mutation.
clientMutationId: String
additional_info: String
artist_id: String!
authenticity_certificate: Boolean
additionalInfo: String
artistID: String!
authenticityCertificate: Boolean
category: Category
currency: String
depth: String
dimensions_metric: String
dimensionsMetric: String
edition: Boolean
edition_number: String
edition_size: Int
editionNumber: String
editionSize: Int
height: String
location_city: String
location_country: String
location_state: String
locationCity: String
locationCountry: String
locationState: String
medium: String
minimum_price_dollars: Int
minimumPriceDollars: Int
provenance: String
signature: Boolean
state: State
Expand All @@ -74,25 +75,19 @@ input CreateConsignmentSubmissionInput {
year: String
}

# Autogenerated return type of CreateConsignmentSubmission
type CreateConsignmentSubmissionPayload {
# Autogenerated return type of CreateSubmissionMutation
type CreateSubmissionMutationPayload {
# A unique identifier for the client performing the mutation.
clientMutationId: String
consignment_submission: Submission
consignmentSubmission: Submission
}

# Mutation root for this schema
type Mutation {
# Create an asset
addAssetToConsignmentSubmission(
input: AddAssetToConsignmentSubmissionInput
): AddAssetToConsignmentSubmissionPayload
createConsignmentSubmission(
input: CreateConsignmentSubmissionInput
): CreateConsignmentSubmissionPayload
updateConsignmentSubmission(
input: UpdateConsignmentSubmissionInput
): UpdateConsignmentSubmissionPayload
addAssetToConsignmentSubmission(input: AddAssetToConsignmentSubmissionInput): AddAssetToConsignmentSubmissionPayload
createConsignmentSubmission(input: CreateSubmissionMutationInput): CreateSubmissionMutationPayload
updateConsignmentSubmission(input: UpdateSubmissionMutationInput): UpdateSubmissionMutationPayload
}

# Information about pagination in a connection.
Expand Down Expand Up @@ -164,6 +159,7 @@ type Submission {

# Uniq ID for this submission
id: ID!
internalID: ID
location_city: String
location_country: String
location_state: String
Expand Down Expand Up @@ -196,27 +192,27 @@ type SubmissionEdge {
node: Submission
}

# Autogenerated input type of UpdateConsignmentSubmission
input UpdateConsignmentSubmissionInput {
# Autogenerated input type of UpdateSubmissionMutation
input UpdateSubmissionMutationInput {
# A unique identifier for the client performing the mutation.
clientMutationId: String
id: ID!
additional_info: String
artist_id: String
authenticity_certificate: Boolean
additionalInfo: String
artistID: String
authenticityCertificate: Boolean
category: Category
currency: String
depth: String
dimensions_metric: String
dimensionsMetric: String
edition: Boolean
edition_number: String
edition_size: Int
editionNumber: String
editionSize: Int
height: String
location_city: String
location_country: String
location_state: String
locationCity: String
locationCountry: String
locationState: String
medium: String
minimum_price_dollars: Int
minimumPriceDollars: Int
provenance: String
signature: Boolean
state: State
Expand All @@ -225,9 +221,9 @@ input UpdateConsignmentSubmissionInput {
year: String
}

# Autogenerated return type of UpdateConsignmentSubmission
type UpdateConsignmentSubmissionPayload {
# Autogenerated return type of UpdateSubmissionMutation
type UpdateSubmissionMutationPayload {
# A unique identifier for the client performing the mutation.
clientMutationId: String
consignment_submission: Submission
consignmentSubmission: Submission
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { runAuthenticatedQuery } from "schema/v1/test/utils"
import gql from "lib/gql"

describe("addAssetToConsignmentSubmission", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("addAssetToConsignmentSubmission", () => {
it("creates a submission and returns its new data payload", () => {
const mutation = gql`
mutation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { config as createSubmissionMutation } from "schema/v1/me/consignments/cr

import gql from "lib/gql"

describe("UpdateSubmissionMutation", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("UpdateSubmissionMutation", () => {
it("does not include the id param", () => {
const mutation = createSubmissionMutation
expect(Object.keys(mutation.inputFields)).not.toContain("id")
Expand Down
3 changes: 2 additions & 1 deletion src/schema/v1/me/__tests__/consignments/submissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { runAuthenticatedQuery } from "schema/v1/test/utils"
import gql from "lib/gql"

describe("submissions", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("submissions", () => {
it("asks for a user's submissions", () => {
const mutation = gql`
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { runAuthenticatedQuery } from "schema/v1/test/utils"
import { config as updateSubmissionMutation } from "schema/v1/me/consignments/update_submission_mutation"
import gql from "lib/gql"

describe("UpdateSubmissionMutation", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("UpdateSubmissionMutation", () => {
it("includes the id param", () => {
const mutation = updateSubmissionMutation
expect(Object.keys(mutation.inputFields)).toContain("id")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable promise/always-return */
import { runAuthenticatedQuery } from "schema/v2/test/utils"

describe("addAssetToConsignmentSubmission", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("addAssetToConsignmentSubmission", () => {
it("creates a submission and returns its new data payload", async () => {
const mutation = `
mutation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { runAuthenticatedQuery } from "schema/v2/test/utils"
import gql from "lib/gql"

describe("CreateGeminiEntryForAsset", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("CreateGeminiEntryForAsset", () => {
it("creates a submission and returns its new data payload", () => {
const mutation = gql`
mutation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { runAuthenticatedQuery } from "schema/v2/test/utils"
import gql from "lib/gql"

describe("addAssetToConsignmentSubmission", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("addAssetToConsignmentSubmission", () => {
it("creates a submission and returns its new data payload", () => {
const mutation = gql`
mutation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { config as createSubmissionMutation } from "schema/v2/me/consignments/cr

import gql from "lib/gql"

describe("UpdateSubmissionMutation", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("UpdateSubmissionMutation", () => {
it("does not include the id param", () => {
const mutation = createSubmissionMutation
expect(Object.keys(mutation.inputFields)).not.toContain("id")
Expand Down
3 changes: 2 additions & 1 deletion src/schema/v2/me/__tests__/consignments/submissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { runAuthenticatedQuery } from "schema/v2/test/utils"
import gql from "lib/gql"

describe("submissions", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("submissions", () => {
it("asks for a user's submissions", async () => {
const mutation = gql`
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { runAuthenticatedQuery } from "schema/v2/test/utils"
import { config as updateSubmissionMutation } from "schema/v2/me/consignments/update_submission_mutation"
import gql from "lib/gql"

describe("UpdateSubmissionMutation", () => {
// FIXME: We're now stitching. Remove these files once this work settles
xdescribe("UpdateSubmissionMutation", () => {
it("includes the id param", () => {
const mutation = updateSubmissionMutation
expect(Object.keys(mutation.inputFields)).toContain("id")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* FIXME: Deprecated. Remove once Convection stitching settles for a bit
*/

import { GraphQLString, GraphQLNonNull } from "graphql"
import { mutationWithClientMutationId } from "graphql-relay"
import { AssetType } from "./asset"
Expand Down
4 changes: 4 additions & 0 deletions src/schema/v2/me/consignments/create_submission_mutation.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* FIXME: Deprecated. Remove once Convection stitching settles for a bit
*/

import { mutationWithClientMutationId, MutationConfig } from "graphql-relay"
import {
SubmissionType,
Expand Down
4 changes: 4 additions & 0 deletions src/schema/v2/me/consignments/update_submission_mutation.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* FIXME: Deprecated. Remove once Convection stitching settles for a bit
*/

import { mutationWithClientMutationId, MutationConfig } from "graphql-relay"
import {
SubmissionType,
Expand Down
17 changes: 0 additions & 17 deletions src/schema/v2/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ import { UserField } from "./user"
import UpdateConversationMutation from "./me/conversation/update_conversation_mutation"
import SendConversationMessageMutation from "./me/conversation/send_message_mutation"
import UpdateCollectorProfile from "./me/update_collector_profile"
import CreateSubmissionMutation from "./me/consignments/create_submission_mutation"
import UpdateSubmissionMutation from "./me/consignments/update_submission_mutation"
import AddAssetToConsignmentSubmission from "./me/consignments/add_asset_to_submission_mutation"
import SaveArtworkMutation from "./me/save_artwork_mutation"
import { endSaleMutation } from "./sale/end_sale_mutation"
import CreateAssetRequestLoader from "./asset_uploads/create_asset_request_mutation"
Expand All @@ -83,23 +80,10 @@ import { ShowArtworkGridType } from "./artwork/artworkContextGrids/ShowArtworkGr

import ObjectIdentification from "./object_identification"
import { ResolverContext } from "types/graphql"
import config from "config"
import { ArtworkVersionType } from "./artwork_version"
import { HighlightsField } from "./Highlights"
import { startIdentityVerificationMutation } from "./startIdentityVerificationMutation"

const { ENABLE_CONSIGNMENTS_STITCHING } = config

// If you're using stitching then we _don't_ want to include particular mutations
// which come from the stitching instead of our manual version
const stitchedMutations: any = {}

if (!ENABLE_CONSIGNMENTS_STITCHING) {
stitchedMutations.createConsignmentSubmission = CreateSubmissionMutation
stitchedMutations.updateConsignmentSubmission = UpdateSubmissionMutation
stitchedMutations.addAssetToConsignmentSubmission = AddAssetToConsignmentSubmission
}

const PrincipalFieldDirective = new GraphQLDirective({
name: "principalField",
locations: [DirectiveLocation.FIELD],
Expand Down Expand Up @@ -194,7 +178,6 @@ export default new GraphQLSchema({
requestCredentialsForAssetUpload: CreateAssetRequestLoader,
createGeminiEntryForAsset: CreateGeminiEntryForAsset,
startIdentityVerification: startIdentityVerificationMutation,
...stitchedMutations,
},
}),
query: new GraphQLObjectType<any, ResolverContext>({
Expand Down

0 comments on commit a5d6b3d

Please sign in to comment.