From ef2f3d47e2edb9d6bb066f6afbfecd4678678a7e Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Thu, 24 Mar 2022 11:25:19 -0300 Subject: [PATCH 01/13] fix: modules that don't belong to a finish also show up --- src/schema/project.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/project.ts b/src/schema/project.ts index d8afcd8..565eb74 100644 --- a/src/schema/project.ts +++ b/src/schema/project.ts @@ -45,11 +45,11 @@ export const Project = objectType({ const modules = await ctx.prisma.module.findMany({ where: { collectionId: root.collectionId, - finishId: root.finishId, externalId: { not: null }, OR: [ { moduleType: { some: { typeId: { equals: root.typeId } } }, + finishId: root.finishId, hasPegs: root.hasPegs }, { From c6d17506ddb09e61c21e168ec15176d164bf870a Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Thu, 24 Mar 2022 15:49:44 -0300 Subject: [PATCH 02/13] fix: fixes query that shows modules of other collections --- src/schema/project.ts | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/schema/project.ts b/src/schema/project.ts index 565eb74..79cb5d6 100644 --- a/src/schema/project.ts +++ b/src/schema/project.ts @@ -47,13 +47,37 @@ export const Project = objectType({ collectionId: root.collectionId, externalId: { not: null }, OR: [ + // Basic filter. Grabs modules based on selected options { moduleType: { some: { typeId: { equals: root.typeId } } }, - finishId: root.finishId, - hasPegs: root.hasPegs + hasPegs: root.hasPegs, + finishId: root.finishId }, + // Same as basic filter BUT { - alwaysDisplay: true + moduleType: { some: { typeId: { equals: root.typeId } } }, + hasPegs: root.hasPegs, + // Also grabs all modules that the finish does not belong to the selected collection (makes aluminum modules show) + finish: { + collectionFinishes: { + none: { collectionId: root.collectionId } + } + } + }, + // Also grabs modules where they're set as alwaysDisplay regardless of peg + { + alwaysDisplay: true, + finishId: root.finishId + }, + // Grabs modules where they're set as alwaysDisplay regardless of peg BUT + { + alwaysDisplay: true, + // Also grabs all modules that the finish does not belong to the selected collection (makes aluminum modules show) + finish: { + collectionFinishes: { + none: { collectionId: root.collectionId } + } + } } ], isSubmodule: false, From f9bf2e018d39b07f9bdd4b96138d8611bf285a00 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Thu, 31 Mar 2022 13:43:38 -0300 Subject: [PATCH 03/13] feat: favors external id when syncing modules --- src/services/marathon/index.ts | 278 +++++++++++++++++---------------- 1 file changed, 142 insertions(+), 136 deletions(-) diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index 8d37dfa..660e461 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -199,17 +199,16 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (categories && categories.length > 0) { console.log(`Fetched ${categories.length} categories`); - const slugs = categories - .map((categoryEdge) => categoryEdge?.node?.slug?.trim() as string) // Casting because we're filtering right after + const ids = categories + .map((categoryEdge) => categoryEdge?.node?.id as string) // Casting because we're filtering right after .filter((x) => !!x); - // const externalIds = categories.map(({ node: category }) => category.id); // Get all categories that we already have const existingCategories = await db.category.findMany({ - select: { slug: true }, + select: { externalId: true }, where: { - slug: { - in: slugs + externalId: { + in: ids } } }); @@ -217,25 +216,28 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Received categories const categoriesToUpdate = categories.filter((categoryEdge) => // Where exists in the database - existingCategories.some((cat) => cat.slug === categoryEdge?.node?.slug?.trim()) + existingCategories.some((cat) => cat.externalId === categoryEdge?.node?.id) ); // Received categories const categoriesToCreate = categories.filter( // Where it DOESN'T exist in the database - (categoryEdge) => !existingCategories.some((cat) => cat.slug === categoryEdge?.node?.slug?.trim()) + (categoryEdge) => !existingCategories.some((cat) => cat.externalId === categoryEdge?.node?.id) ); for (let i = 0; i < categoriesToUpdate.length; i++) { const categoryEdge = categoriesToUpdate[i]; - const slug = categoryEdge?.node?.slug?.trim(); - console.log(`Updating category #${i + 1} ${slug} of ${categoriesToUpdate.length}`); + const id = categoryEdge?.node?.id; + + if (!id) continue; + + console.log(`Updating category #${i + 1} id: ${id} of ${categoriesToUpdate.length}`); await db.category.update({ - where: { slug }, + where: { externalId: id }, data: { - externalId: categoryEdge?.node?.id?.trim(), - name: categoryEdge?.node?.name?.trim() + name: categoryEdge?.node?.name?.trim(), + slug: categoryEdge?.node?.slug?.trim() } }); } @@ -247,7 +249,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter((categoryEdge) => categoryEdge?.node?.id && categoryEdge?.node?.slug && categoryEdge?.node?.name) .map((categoryEdge) => ({ // Casting because we're sure, since there's a filter right above - externalId: categoryEdge?.node?.id?.trim() as string, + externalId: categoryEdge?.node?.id as string, slug: categoryEdge?.node?.slug?.trim() as string, name: categoryEdge?.node?.name?.trim() as string })) @@ -285,13 +287,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (collections && collections.length > 0) { console.log(`Fetched ${collections.length} collections`); - const slugs = collections - .map((collectionEdge) => collectionEdge?.node?.slug?.trim() as string) // Casting because we're filtering right after + const ids = collections + .map((collectionEdge) => collectionEdge?.node?.id as string) // Casting because we're filtering right after .filter((x) => !!x); const existingCollections = await db.collection.findMany({ select: { - slug: true, + externalId: true, thumbnailUrl: true, translations: { where: { locale: defaultSyncLocale }, @@ -299,8 +301,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }, where: { - slug: { - in: slugs + externalId: { + in: ids } } }); @@ -308,7 +310,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Received collections const collectionsToUpdate = collections.filter((collectionEdge) => // Where exists in the database - existingCollections.some((col) => col.slug === collectionEdge?.node?.slug?.trim()) + existingCollections.some((col) => col.externalId === collectionEdge?.node?.id) ); const whitelistedSlugs = MARATHON_COLLECTIONS_WHITELIST.split(',').filter((x) => !!x); @@ -318,32 +320,33 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Where it DOESN'T exist in the database (collectionEdge) => collectionEdge?.node?.slug?.trim() && - !existingCollections.some((col) => col.slug === collectionEdge?.node?.slug?.trim()) && + !existingCollections.some((col) => col.externalId === collectionEdge?.node?.id) && whitelistedSlugs.includes(collectionEdge.node.slug.trim()) ); for (let i = 0; i < collectionsToUpdate.length; i++) { const collectionEdge = collectionsToUpdate[i]; - const slug = collectionEdge?.node?.slug?.trim(); + const id = collectionEdge?.node?.id; - const currentCollection = existingCollections.find((x) => x.slug === slug); - if (!currentCollection) continue; + const currentCollection = existingCollections.find((x) => x.externalId === id); + if (!currentCollection || !currentCollection.externalId) continue; - console.log(`Updating collection #${i + 1} ${slug} of ${collectionsToUpdate.length}`); + console.log( + `Updating collection #${i + 1} id: ${currentCollection.externalId} of ${collectionsToUpdate.length}` + ); const translationIds = currentCollection.translations.map((x) => x.id); await db.collection.update({ - where: { slug }, + where: { externalId: currentCollection.externalId }, data: { - externalId: collectionEdge?.node?.id?.trim(), + slug: collectionEdge?.node?.slug?.trim(), thumbnailUrl: makeThumbnailUrlAndQueue( collectionEdge?.node?.image?.fullpath, currentCollection.thumbnailUrl ), hasPegs: collectionEdge?.node?.hasPegs || undefined, isComingSoon: collectionEdge?.node?.isComingSoon || undefined, - translations: translationIds && translationIds.length > 0 ? { @@ -369,11 +372,11 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter((collectionEdge) => collectionEdge?.node?.id && collectionEdge?.node?.slug) .map((collectionEdge) => ({ // Casting because we're sure, since there's a filter right above - externalId: collectionEdge?.node?.id?.trim() as string, + externalId: collectionEdge?.node?.id as string, slug: collectionEdge?.node?.slug?.trim() as string, thumbnailUrl: makeThumbnailUrlAndQueue( collectionEdge?.node?.image?.fullpath?.trim(), - `image/collection/${collectionEdge?.node?.slug?.trim()}${path.extname( + `images/collection/${collectionEdge?.node?.slug?.trim()}${path.extname( collectionEdge?.node?.image?.fullpath?.trim() || '' )}}` ), @@ -384,10 +387,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetching recently created ${collectionsToCreate.length} collections`); const recentlyCreatedCollections = await db.collection.findMany({ - where: { slug: { in: collectionsToCreate.map((x) => x?.node?.slug?.trim() as string).filter((x) => !!x) } }, + where: { externalId: { in: collectionsToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, - slug: true + externalId: true } }); @@ -396,7 +399,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { data: recentlyCreatedCollections.map((dbCollection) => { // The type is undefined, but we're sure it returns correctly(at least it should) // Worst case translations will be empty, and that's their fault - const collection = collectionsToCreate.find((x) => x?.node?.slug?.trim() === dbCollection.slug); + const collection = collectionsToCreate.find((x) => x?.node?.id === dbCollection.externalId); return { locale: defaultSyncLocale, @@ -440,13 +443,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (drawerTypes && drawerTypes.length > 0) { console.log(`Fetched ${drawerTypes.length} drawer types`); - const slugs = drawerTypes - .map((drawerTypeEdge) => drawerTypeEdge?.node?.slug?.trim() as string) // Casting because we filter right after + const ids = drawerTypes + .map((drawerTypeEdge) => drawerTypeEdge?.node?.id as string) // Casting because we filter right after .filter((x) => !!x); const existingDrawerTypes = await db.type.findMany({ select: { - slug: true, + externalId: true, thumbnailUrl: true, translations: { where: { locale: defaultSyncLocale }, @@ -454,8 +457,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }, where: { - slug: { - in: slugs + externalId: { + in: ids } } }); @@ -463,7 +466,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Received drawer types const drawerTypesToUpdate = drawerTypes.filter((drawerTypeEdge) => // Where exists in the database - existingDrawerTypes.some((type) => type.slug === drawerTypeEdge?.node?.slug?.trim()) + existingDrawerTypes.some((type) => type.externalId === drawerTypeEdge?.node?.id) ); const whitelistedSlugs = MARATHON_DRAWER_TYPES_WHITELIST.split(',').filter((x) => !!x); @@ -473,25 +476,27 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Where it DOESN'T exist in the database (drawerTypeEdge) => drawerTypeEdge?.node?.slug?.trim() && - !existingDrawerTypes.some((type) => type.slug === drawerTypeEdge?.node?.slug?.trim()) && + !existingDrawerTypes.some((type) => type.externalId === drawerTypeEdge?.node?.id) && whitelistedSlugs.includes(drawerTypeEdge.node.slug.trim()) ); for (let i = 0; i < drawerTypesToUpdate.length; i++) { const drawerTypeEdge = drawerTypesToUpdate[i]; - const slug = drawerTypeEdge?.node?.slug?.trim(); + const id = drawerTypeEdge?.node?.id; - const currentDrawerType = existingDrawerTypes.find((x) => x.slug === slug); - if (!currentDrawerType) continue; + const currentDrawerType = existingDrawerTypes.find((x) => x.externalId === id); + if (!currentDrawerType || !currentDrawerType.externalId) continue; - console.log(`Updating drawer type #${i + 1} ${slug} of ${drawerTypesToUpdate.length}`); + console.log( + `Updating drawer type #${i + 1} id: ${currentDrawerType.externalId} of ${drawerTypesToUpdate.length}` + ); const translationIds = currentDrawerType.translations.map((x) => x.id); await db.type.update({ - where: { slug }, + where: { externalId: currentDrawerType.externalId }, data: { - externalId: drawerTypeEdge?.node?.id?.trim(), + slug: drawerTypeEdge?.node?.slug?.trim(), thumbnailUrl: makeThumbnailUrlAndQueue( drawerTypeEdge?.node?.image?.fullpath, currentDrawerType.thumbnailUrl @@ -523,11 +528,11 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter((drawerTypeEdge) => drawerTypeEdge?.node?.id && drawerTypeEdge?.node?.slug) .map((drawerTypeEdge) => ({ // Casting because we're filtering right above - externalId: drawerTypeEdge?.node?.id?.trim() as string, + externalId: drawerTypeEdge?.node?.id as string, slug: drawerTypeEdge?.node?.slug?.trim() as string, thumbnailUrl: makeThumbnailUrlAndQueue( drawerTypeEdge?.node?.image?.fullpath?.trim(), - `image/type/${drawerTypeEdge?.node?.slug?.trim()}${path.extname( + `images/type/${drawerTypeEdge?.node?.slug?.trim()}${path.extname( drawerTypeEdge?.node?.image?.fullpath?.trim() || '' )}` ), @@ -538,10 +543,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetching recently created ${drawerTypesToCreate.length} drawer types`); const recentlyCreatedDrawerTypes = await db.collection.findMany({ - where: { slug: { in: drawerTypesToCreate.map((x) => x?.node?.slug?.trim() as string).filter((x) => !!x) } }, + where: { externalId: { in: drawerTypesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, - slug: true + externalId: true } }); @@ -549,7 +554,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await db.typeTranslations.createMany({ data: recentlyCreatedDrawerTypes.map((dbType) => { // This returns undefined, but we're sure it returns correctly(at least it should) - const drawerType = drawerTypesToCreate.find((x) => x?.node?.slug?.trim() === dbType.slug); + const drawerType = drawerTypesToCreate.find((x) => x?.node?.id === dbType.externalId); return { locale: defaultSyncLocale, @@ -591,13 +596,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (finishes && finishes.length > 0) { console.log(`Fetched ${finishes.length} finishes`); - const slugs = finishes - .map((finishEdge) => finishEdge?.node?.slug?.trim() as string) // Casting since we're filtering right after + const ids = finishes + .map((finishEdge) => finishEdge?.node?.id as string) // Casting since we're filtering right after .filter((x) => !!x); const existingFinishes = await db.finish.findMany({ select: { - slug: true, + externalId: true, thumbnailUrl: true, translations: { where: { locale: defaultSyncLocale }, @@ -605,8 +610,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }, where: { - slug: { - in: slugs + externalId: { + in: ids } } }); @@ -614,7 +619,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Received finishes const finishesToUpdate = finishes.filter((finishEdge) => // Where exists in the database - existingFinishes.some((fin) => fin.slug === finishEdge?.node?.slug?.trim()) + existingFinishes.some((fin) => fin.externalId === finishEdge?.node?.id) ); const whitelistedSlugs = MARATHON_FINISHES_WHITELIST.split(',').filter((x) => !!x); @@ -624,25 +629,25 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Where it DOESN'T exist in the database (finishEdge) => finishEdge?.node?.slug?.trim() && - !existingFinishes.some((fin) => fin.slug === finishEdge?.node?.slug?.trim()) && + !existingFinishes.some((fin) => fin.externalId === finishEdge?.node?.id) && whitelistedSlugs.includes(finishEdge.node.slug.trim()) ); for (let i = 0; i < finishesToUpdate.length; i++) { const finishEdge = finishesToUpdate[i]; - const slug = finishEdge?.node?.slug?.trim(); + const id = finishEdge?.node?.id; - const currentFinish = existingFinishes.find((x) => x.slug === slug); - if (!currentFinish) continue; + const currentFinish = existingFinishes.find((x) => x.externalId === id); + if (!currentFinish || !currentFinish.externalId) continue; - console.log(`Updating finish #${i + 1} ${slug} of ${finishesToUpdate.length}`); + console.log(`Updating finish #${i + 1} id: ${id} of ${finishesToUpdate.length}`); const translationIds = currentFinish.translations.map((x) => x.id); await db.finish.update({ - where: { slug }, + where: { externalId: currentFinish.externalId }, data: { - externalId: finishEdge?.node?.id?.trim(), + slug: finishEdge?.node?.slug?.trim(), thumbnailUrl: makeThumbnailUrlAndQueue(finishEdge?.node?.image?.fullpath, currentFinish.thumbnailUrl), translations: translationIds && translationIds.length > 0 @@ -674,7 +679,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { slug: finishEdge?.node?.slug?.trim() as string, thumbnailUrl: makeThumbnailUrlAndQueue( finishEdge?.node?.image?.fullpath?.trim(), - `image/finish/${finishEdge?.node?.slug?.trim()}${path.extname( + `images/finish/${finishEdge?.node?.slug?.trim()}${path.extname( finishEdge?.node?.image?.fullpath?.trim() || '' )}` ) @@ -683,10 +688,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetching recently created ${finishesToCreate.length} finishes`); const recentlyCreatedFinishes = await db.finish.findMany({ - where: { slug: { in: finishesToCreate.map((x) => x?.node?.slug?.trim() as string).filter((x) => !!x) } }, + where: { externalId: { in: finishesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, - slug: true + externalId: true } }); @@ -694,7 +699,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await db.finishTranslations.createMany({ data: recentlyCreatedFinishes.map((dbFinish) => { // This returns undefined, but we're sure it returns correctly(at least it should) - const finish = finishesToCreate.find((x) => x?.node?.slug?.trim() === dbFinish.slug); + const finish = finishesToCreate.find((x) => x?.node?.id === dbFinish.externalId); return { locale: defaultSyncLocale, @@ -760,7 +765,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (typeof value !== 'number') value = parseFloat(`${value}`); - // Castng because we convert the value above + // Casting because we convert the value above return value && !isNaN(value as number) ? (value as number) : 0; }; @@ -952,6 +957,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const existingCategories = await db.category.findMany({ select: { id: true, + externalId: true, slug: true } }); @@ -959,21 +965,21 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const existingTypes = await db.type.findMany({ select: { id: true, - slug: true + externalId: true } }); const existingFinishes = await db.finish.findMany({ select: { id: true, - slug: true + externalId: true } }); const existingCollections = await db.collection.findMany({ select: { id: true, - slug: true + externalId: true } }); @@ -997,28 +1003,21 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (products && products.length > 0) { console.log(`Product page ${pageIndex + 1}, fetched ${products.length} products`); - const partNumbers = products + const ids = products // Casting because we're explicitly filtering by only valid values - .map((productEdge) => productEdge?.node?.partNumber?.trim() as string) + .map((productEdge) => productEdge?.node?.id as string) .filter((x) => !!x); - const noPartNumberModules = products.filter((x) => !x?.node?.partNumber); - if (noPartNumberModules && noPartNumberModules.length > 0) { - logging.warn(`Sync: ${noPartNumberModules.length} modules without part number. Which will get ignored`, { - noPartNumberModules: noPartNumberModules.map((x) => x?.node?.id) - }); - } - const existingModules = await db.module.findMany({ select: { id: true, - partNumber: true, + externalId: true, rules: true, thumbnailUrl: true }, where: { - partNumber: { - in: partNumbers + externalId: { + in: ids } } }); @@ -1027,8 +1026,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const modulesToUpdate = products.filter( (productEdge) => // Where exists in the database - productEdge?.node?.partNumber?.trim() && - existingModules.some((mod) => mod.partNumber === productEdge?.node?.partNumber?.trim()) + productEdge?.node?.id && existingModules.some((mod) => mod.externalId === productEdge?.node?.id) ); // Received products @@ -1038,20 +1036,20 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const module = productEdge?.node; const finishId = - existingFinishes.find((finish) => finish.slug === module?.spFinish?.slug?.trim())?.id || undefined; + existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || undefined; const collectionId = - existingCollections.find((collection) => collection.slug === module?.spCollection?.slug?.trim())?.id || + existingCollections.find((collection) => collection.externalId === module?.spCollection?.id)?.id || undefined; const hasExpectedCondition = finishId !== undefined && collectionId !== undefined && - module?.partNumber?.trim() && - !existingModules.some((mod) => mod.partNumber === module.partNumber?.trim()); + module?.id && + !existingModules.some((mod) => mod.externalId === module.id); if (!hasExpectedCondition) { // Casting because we know it should exist, since there's a condition for that in hasExpectedCondition - ignoredModules.push(module?.partNumber as string); + ignoredModules.push(module?.id as string); } return hasExpectedCondition; @@ -1076,7 +1074,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { description: module?.titleDescription?.trim() || undefined, thumbnailUrl: makeThumbnailUrlAndQueue( sourceThumbnail, - `image/module/${module?.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` + `images/module/${module?.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` ), // bundleUrl: module?.bundlePath?.fullpath?.trim() || undefined, // FIX: Uncomment after also importing/uploading the image isSubmodule: module?.isSubmodule || false, @@ -1090,14 +1088,14 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { alwaysDisplay: module?.alwaysDisplay || false, isEdge: module?.isEdge || false, rules, - finishId: - existingFinishes.find((finish) => finish.slug === module?.spFinish?.slug?.trim())?.id || -1, + finishId: existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || -1, collectionId: - existingCollections.find((collection) => collection.slug === module?.spCollection?.slug?.trim()) + existingCollections.find((collection) => collection.externalId === module?.spCollection?.id) ?.id || -1 // TODO: Default left extension // TODO: Default right extension // TODO: attachmentToAppend: newRules?.rules. + // TODO: module attachments }; }) }); @@ -1105,13 +1103,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetching recently created ${modulesToCreate.length} products`); const recentlyCreatedModules = await db.module.findMany({ where: { - partNumber: { - in: modulesToCreate.map((x) => x?.node?.partNumber?.trim() as string).filter((x) => !!x) + externalId: { + in: modulesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, - partNumber: true + externalId: true } }); @@ -1119,14 +1117,16 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const categoriesToCreate = modulesToCreate.flatMap((productEdge) => productEdge?.node?.spCategories?.map((cat) => ({ - catSlug: cat?.slug?.trim(), - modulePartNumber: productEdge?.node?.partNumber?.trim() + catExternalId: cat?.id, + catSlug: null, + moduleExternalId: productEdge?.node?.id })) ); const categoryAllToCreate = modulesToCreate.map((productEdge) => ({ catSlug: 'all', - modulePartNumber: productEdge?.node?.partNumber?.trim() + catExternalId: null, + moduleExternalId: productEdge?.node?.id })); await db.moduleCategory.createMany({ @@ -1135,8 +1135,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .map((catModule) => { return { moduleId: - recentlyCreatedModules.find((x) => x.partNumber === catModule?.modulePartNumber)?.id || -1, - categoryId: existingCategories.find((x) => x.slug === catModule?.catSlug)?.id || -1 + recentlyCreatedModules.find((x) => x.externalId === catModule?.moduleExternalId)?.id || -1, + categoryId: + existingCategories.find((x) => + catModule?.catExternalId + ? x.externalId === catModule?.catExternalId + : x.slug === catModule?.catSlug + )?.id || -1 }; }) }); @@ -1146,18 +1151,17 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { data: modulesToCreate .flatMap((productEdge) => productEdge?.node?.spDrawerTypes?.map((type) => ({ - typeSlug: type?.slug?.trim(), - modulePartNumber: productEdge?.node?.partNumber?.trim() + typeExternalId: type?.id, + moduleExternalId: productEdge?.node?.id })) ) .filter((x) => !!x) .map((typeModule) => ({ moduleId: - recentlyCreatedModules.find((x) => x.partNumber === typeModule?.modulePartNumber)?.id || -1, - typeId: existingTypes.find((x) => x.slug === typeModule?.typeSlug)?.id || -1 + recentlyCreatedModules.find((x) => x.externalId === typeModule?.moduleExternalId)?.id || -1, + typeId: existingTypes.find((x) => x.externalId === typeModule?.typeExternalId)?.id || -1 })) }); - // TODO: module attachments }); } catch (err) { logging.error(err, 'Error when batch creating products', { @@ -1173,13 +1177,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { for (let i = 0; i < modulesToUpdate.length; i++) { const productEdge = modulesToUpdate[i]; - const module = productEdge?.node; - if (!module?.partNumber?.trim()) return; + const moduleEdge = productEdge?.node; + if (!moduleEdge?.id) continue; - const existingModule = existingModules.find((x) => x.partNumber === module.partNumber?.trim()); + const existingModule = existingModules.find((x) => x.externalId === moduleEdge.id); if (!existingModule) continue; - console.log(`Updating module #${i + 1} ${module.partNumber?.trim()} of ${modulesToUpdate.length}`); + console.log(`Updating module #${i + 1} id: ${moduleEdge.id} of ${modulesToUpdate.length}`); const rules = existingModule?.rules as NexusGenObjects['ModuleRules'] | undefined; await db.$transaction(async (db) => { @@ -1187,14 +1191,14 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Delete existing categories to re create await db.moduleCategory.deleteMany({ - where: { module: { partNumber: module.partNumber?.trim() }, category: { slug: { not: 'all' } } } + where: { module: { externalId: moduleEdge.id }, category: { slug: { not: 'all' } } } }); // If there are categories for this module - if (module.spCategories && module.spCategories.length > 0) { + if (moduleEdge.spCategories && moduleEdge.spCategories.length > 0) { // Create them await db.moduleCategory.createMany({ - data: module.spCategories.map((cat) => ({ + data: moduleEdge.spCategories.map((cat) => ({ moduleId: existingModule?.id || -1, categoryId: existingCategories.find((x) => x.slug === cat?.slug?.trim())?.id || -1 })) @@ -1204,60 +1208,62 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Sync type // Delete existing types to then create - await db.moduleType.deleteMany({ where: { module: { partNumber: module.partNumber?.trim() } } }); + await db.moduleType.deleteMany({ where: { module: { externalId: moduleEdge.id } } }); // If there are types for this module - if (module.spDrawerTypes && module.spDrawerTypes.length > 0) { + if (moduleEdge.spDrawerTypes && moduleEdge.spDrawerTypes.length > 0) { // Create them await db.moduleType.createMany({ - data: module.spDrawerTypes.map((type) => ({ + data: moduleEdge.spDrawerTypes.map((type) => ({ moduleId: existingModule?.id || -1, - typeId: existingTypes.find((x) => x.slug === type?.slug?.trim())?.id || -1 + typeId: existingTypes.find((x) => x.externalId === type?.id)?.id || -1 })) }); } // TODO: module attachments - const newRules = mergeRules(module, rules); + const newRules = mergeRules(moduleEdge, rules); const sourceThumbnail = - module.productPictures && module.productPictures.length > 0 - ? module.productPictures[0]?.fullpath?.trim() + moduleEdge.productPictures && moduleEdge.productPictures.length > 0 + ? moduleEdge.productPictures[0]?.fullpath?.trim() : undefined; await db.module.update({ - where: { partNumber: module.partNumber?.trim() }, + // Casting because we're sure it exists due to previous check + where: { externalId: moduleEdge.id as string }, data: { - externalId: module.id?.trim(), - description: module.titleDescription?.trim() || undefined, + externalId: moduleEdge.id?.trim(), + description: moduleEdge.titleDescription?.trim() || undefined, thumbnailUrl: makeThumbnailUrlAndQueue(sourceThumbnail, existingModule.thumbnailUrl), // bundleUrl: module.bundlePath?.fullpath?.trim() || undefined, // FIX: Uncomment after also importing/uploading the image - isSubmodule: module.isSubmodule || undefined, - hasPegs: module.hasPegs || undefined, - isMat: module.isMat || undefined, + isSubmodule: moduleEdge.isSubmodule || undefined, + hasPegs: moduleEdge.hasPegs || undefined, + isMat: moduleEdge.isMat || undefined, // isExtension: module.isExtension || false, shouldHideBasedOnWidth: - module.shouldHideBasedOnWidth !== undefined && module.shouldHideBasedOnWidth !== null - ? module.shouldHideBasedOnWidth + moduleEdge.shouldHideBasedOnWidth !== undefined && moduleEdge.shouldHideBasedOnWidth !== null + ? moduleEdge.shouldHideBasedOnWidth : undefined, // alwaysDisplay: module.alwaysDisplay || undefined, // isEdge: module.isEdge || undefined, rules: newRules, - finish: module.spFinish?.slug?.trim() + finish: moduleEdge.spFinish?.slug?.trim() ? { connect: { - slug: module.spFinish.slug.trim() + slug: moduleEdge.spFinish.slug.trim() } } : undefined, - collection: module.spCollection?.slug?.trim() + collection: moduleEdge.spCollection?.slug?.trim() ? { connect: { - slug: module.spCollection.slug.trim() + slug: moduleEdge.spCollection.slug.trim() } } : undefined, + // TODO: Default left extension defaultLeftExtension: newRules?.extensions?.left ? { connect: { @@ -1265,6 +1271,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } } : undefined, + // TODO: Default right extension defaultRightExtension: newRules?.extensions?.right ? { connect: { @@ -1272,8 +1279,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } } : undefined - // TODO: Default left extension - // TODO: Default right extension // TODO: attachmentToAppend: newRules?.rules. } }); @@ -1411,6 +1416,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const items: MarathonCartItem[] = []; + // Flatten the product list cart .filter((x) => x.projectModule.module.externalId) .forEach((cartItem) => { From 0f7c49a9d9d0e9029a59e5beaddc64975aa98ae2 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Thu, 21 Apr 2022 16:03:42 -0300 Subject: [PATCH 04/13] feat: now all features are considered as rules --- src/cron.ts | 4 +- src/generated/nexus.d.ts | 6 + src/generated/schema.graphql | 10 + src/schema/moduleRules.ts | 8 + src/services/marathon/index.ts | 713 +++++++------------ src/services/marathon/parsing/constants.ts | 38 + src/services/marathon/parsing/parseRules.ts | 334 +++++++++ src/services/marathon/parsing/parseValues.ts | 123 ++++ src/utils/conversion.ts | 6 +- src/utils/file.ts | 11 + 10 files changed, 781 insertions(+), 472 deletions(-) create mode 100644 src/services/marathon/parsing/constants.ts create mode 100644 src/services/marathon/parsing/parseRules.ts create mode 100644 src/services/marathon/parsing/parseValues.ts diff --git a/src/cron.ts b/src/cron.ts index e08c955..41553ca 100644 --- a/src/cron.ts +++ b/src/cron.ts @@ -11,7 +11,7 @@ const scheduleJobs = async (prisma: PrismaClient): Promise => { const marathon = marathonService({ db: prisma }); if (MARATHON_API_SYNC === 'true') { - marathon.syncData(); + marathon.syncData(true); } cron.schedule( @@ -21,7 +21,7 @@ const scheduleJobs = async (prisma: PrismaClient): Promise => { if (MARATHON_API_SYNC === 'true') { try { - await marathon.syncData(); + await marathon.syncData(true); } catch (error) { logging.error(error, 'Daily cronjob has failed.'); } diff --git a/src/generated/nexus.d.ts b/src/generated/nexus.d.ts index 9c9913f..bd5df69 100644 --- a/src/generated/nexus.d.ts +++ b/src/generated/nexus.d.ts @@ -4910,7 +4910,9 @@ export interface NexusGenObjects { }; ModuleRulesMetadata: { // root type + angle?: number | null; // Float fullDepth?: boolean | null; // Boolean + isFiller?: boolean | null; // Boolean options?: string[] | null; // [String!] queue?: NexusGenRootTypes['QueueInfoMetadata'] | null; // QueueInfoMetadata requiredNetInterior?: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax @@ -5200,7 +5202,9 @@ export interface NexusGenFieldTypes { }; ModuleRulesMetadata: { // field return type + angle: number | null; // Float fullDepth: boolean | null; // Boolean + isFiller: boolean | null; // Boolean options: string[] | null; // [String!] queue: NexusGenRootTypes['QueueInfoMetadata'] | null; // QueueInfoMetadata requiredNetInterior: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax @@ -5555,7 +5559,9 @@ export interface NexusGenFieldTypeNames { }; ModuleRulesMetadata: { // field return type name + angle: 'Float'; fullDepth: 'Boolean'; + isFiller: 'Boolean'; options: 'String'; queue: 'QueueInfoMetadata'; requiredNetInterior: 'ModuleMinMax'; diff --git a/src/generated/schema.graphql b/src/generated/schema.graphql index 9465073..0b9e6bb 100644 --- a/src/generated/schema.graphql +++ b/src/generated/schema.graphql @@ -2174,11 +2174,21 @@ type ModuleRules { } type ModuleRulesMetadata { + """ + The amount (in degrees) that the product can be angled + """ + angle: Float + """ Whether or not this module is only valid if it's taking the drawer full depth """ fullDepth: Boolean + """ + Whether or not this module is a filler kind of module + """ + isFiller: Boolean + """ Options are which other modules can be put IN modules """ diff --git a/src/schema/moduleRules.ts b/src/schema/moduleRules.ts index c5d969e..758b1fd 100644 --- a/src/schema/moduleRules.ts +++ b/src/schema/moduleRules.ts @@ -74,6 +74,10 @@ export const ModuleRulesMetadata = objectType({ description: 'The amount (in degrees) that the product can be rotated' }); + t.float('angle', { + description: 'The amount (in degrees) that the product can be angled' + }); + t.list.nonNull.string('options', { description: 'Options are which other modules can be put IN modules' }); @@ -90,6 +94,10 @@ export const ModuleRulesMetadata = objectType({ description: "Whether or not this module is only valid if it's taking the drawer full depth" }); + t.boolean('isFiller', { + description: 'Whether or not this module is a filler kind of module' + }); + t.field('queue', { type: QueueInfoMetadata, description: 'Queue info' diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index 660e461..cc17b1f 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -1,17 +1,13 @@ import { ApolloClient, from, HttpLink, InMemoryCache, NormalizedCacheObject } from '@apollo/client/core'; -// import { print } from 'graphql'; import { Locale, PrismaClient } from '@prisma/client'; +import { rules } from '@typescript-eslint/eslint-plugin'; import { ForbiddenError } from 'apollo-server'; import axios, { AxiosResponse } from 'axios'; import fetch from 'cross-fetch'; -import deepmerge from 'deepmerge'; -import { isEqual } from 'lodash'; import path from 'path'; import { URL } from 'url'; import { env } from '../../env'; import { - CsFeatureMultiselect, - CsFeatureQuantityValue, GetProductListingQuery, GetProductListingQueryVariables, GetSpCategoryListingQuery, @@ -20,12 +16,13 @@ import { GetSpFinishListingQuery } from '../../generated/graphql'; import { NexusGenObjects } from '../../generated/nexus'; -import { convertInToMmFormatted, convertMmToInFormatted } from '../../utils/conversion'; import { makeError } from '../../utils/exception'; -import { replaceExtension } from '../../utils/file'; +import { makeFile, replaceExtension } from '../../utils/file'; import logging from '../../utils/logging'; import { fileUploadService } from '../fileUpload'; import { projectService } from '../project'; +import { MarathonModule } from './parsing/constants'; +import { makeQueueAppendRulesFromMarathonModule, mergeRules } from './parsing/parseRules'; import { GET_PRODUCT_LISTING, GET_SP_CATEGORY_LISTING, @@ -40,25 +37,6 @@ type MarathonServiceDependencies = { let marathonApolloClient: ApolloClient | undefined; -const FEATURE_NAMES = { - DIMENSION_HEIGHT: 'height', - MM_ID: 'mm', - IN_ID: 'in', - MIN_WIDTH: 'width_min', - MAX_WIDTH: 'width_max', - MIN_DEPTH: 'depth_min', - MAX_DEPTH: 'depth_max', - TRIMMABLE: 'trimmable', - TRIM_OFFSET_BOTTOM: 'trim_offset_bottom', - TRIM_OFFSET_TOP: 'trim_offset_top', - TRIM_OFFSET_LEFT: 'trim_offset_left', - TRIM_OFFSET_RIGHT: 'trim_offset_right' -}; - -type MarathonModule = NonNullable< - NonNullable['edges']>[0] ->['node']; - export const marathonService = ({ db }: MarathonServiceDependencies) => { const { MARATHON_API, @@ -180,7 +158,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log('Finished syncing images'); }; - const syncCategory = async () => { + const syncCategory = async (skipDatabase?: boolean) => { if (!db) { throw new Error('db dependency was not provided'); } @@ -196,9 +174,9 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); const categories = data?.getSpCategoryListing?.edges || []; - if (categories && categories.length > 0) { - console.log(`Fetched ${categories.length} categories`); + console.log(`Fetched ${categories.length} categories`); + if (!skipDatabase && categories && categories.length > 0) { const ids = categories .map((categoryEdge) => categoryEdge?.node?.id as string) // Casting because we're filtering right after .filter((x) => !!x); @@ -257,8 +235,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } else { console.log(`No category to create`); } - } else { - console.log('No category has been returned'); } } catch (err) { logging.error(err, 'Error fetching Marathon categories'); @@ -268,7 +244,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('categories'); }; - const syncCollection = async () => { + const syncCollection = async (skipDatabase?: boolean) => { if (!db) { throw new Error('db dependency was not provided'); } @@ -284,9 +260,9 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); const collections = data?.getSpCollectionListing?.edges || []; - if (collections && collections.length > 0) { - console.log(`Fetched ${collections.length} collections`); + console.log(`Fetched ${collections.length} collections`); + if (!skipDatabase && collections && collections.length > 0) { const ids = collections .map((collectionEdge) => collectionEdge?.node?.id as string) // Casting because we're filtering right after .filter((x) => !!x); @@ -413,8 +389,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } else { console.log(`No collection to create`); } - } else { - console.log('No collection has been returned'); } } catch (err) { logging.error(err, 'Error fetching Marathon collections'); @@ -424,7 +398,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('collections'); }; - const syncDrawerType = async () => { + const syncDrawerType = async (skipDatabase?: boolean) => { if (!db) { throw new Error('db dependency was not provided'); } @@ -439,10 +413,9 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); const drawerTypes = data?.getSpDrawerTypesListing?.edges || []; + console.log(`Fetched ${drawerTypes.length} drawer types`); - if (drawerTypes && drawerTypes.length > 0) { - console.log(`Fetched ${drawerTypes.length} drawer types`); - + if (!skipDatabase && drawerTypes && drawerTypes.length > 0) { const ids = drawerTypes .map((drawerTypeEdge) => drawerTypeEdge?.node?.id as string) // Casting because we filter right after .filter((x) => !!x); @@ -567,8 +540,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } else { console.log(`No drawerType to create`); } - } else { - console.log('No drawer type has been returned'); } } catch (err) { logging.error(err, 'Error fetching Marathon drawer types'); @@ -578,7 +549,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('drawerType'); }; - const syncFinish = async () => { + const syncFinish = async (skipDatabase?: boolean) => { if (!db) { throw new Error('db dependency was not provided'); } @@ -593,9 +564,9 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); const finishes = data.getSpFinishListing?.edges || []; - if (finishes && finishes.length > 0) { - console.log(`Fetched ${finishes.length} finishes`); + console.log(`Fetched ${finishes.length} finishes`); + if (!skipDatabase && finishes && finishes.length > 0) { const ids = finishes .map((finishEdge) => finishEdge?.node?.id as string) // Casting since we're filtering right after .filter((x) => !!x); @@ -712,8 +683,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } else { console.log(`No finish to create`); } - } else { - console.log('No finish has been returned'); } } catch (err) { logging.error(err, 'Error fetching Marathon finishes'); @@ -723,225 +692,45 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('finish'); }; - /** - * Tries to grab a value of @param featureName from a feature list - */ - const getQuantityValueFeature = ( - featureList: NonNullable['configuratorAttributes']>[number]>['features'], - featureName: string, - featureUnitId: string, - format?: (value?: unknown) => TResult - ): TResult => { - // Get the feature with the name we want from the list - const feature = featureList?.find((feature) => feature?.name === featureName) as CsFeatureQuantityValue | undefined; - - // If unit is wrong - if (feature?.quantityvalue?.unit?.id && feature.quantityvalue.unit.id !== featureUnitId) { - if (featureUnitId === FEATURE_NAMES.MM_ID && feature.quantityvalue.unit.id === FEATURE_NAMES.IN_ID) { - const inchValue = convertInToMmFormatted(`${feature.quantityvalue.value || 0}`); - - return format ? format(inchValue) : (inchValue as unknown as TResult); - } else if (featureUnitId === FEATURE_NAMES.IN_ID && feature.quantityvalue.unit.id === FEATURE_NAMES.MM_ID) { - const mmValue = convertMmToInFormatted(`${feature.quantityvalue.value || 0}`); - - return format ? format(mmValue) : (mmValue as unknown as TResult); - } else { - throw makeError( - `Expected ${featureName} feature as ${featureUnitId}, but was returned as "${feature?.quantityvalue?.unit?.id}" with value "${feature.quantityvalue.value}"`, - 'ruleMergeFeatureQuantityUnit' - ); - } - } - - // Format or return plain - return format ? format(feature?.quantityvalue?.value) : (feature?.quantityvalue?.value as unknown as TResult); - }; - - /** - * Tries to safely convert a param to a number - */ - const numberFromMaybe = (originalValue?: string | number | null | unknown): number => { - let value = originalValue; - - if (typeof value !== 'number') value = parseFloat(`${value}`); - - // Casting because we convert the value above - return value && !isNaN(value as number) ? (value as number) : 0; - }; - - const makeRulesFromMarathonModule = (marathonModule: MarathonModule): NexusGenObjects['ModuleRules'] => { - const partNumber = marathonModule?.partNumber?.trim(); - if (!partNumber) throw makeError('Cannot create rule without partNumber', 'ruleMergeMissingPartNumber'); - - // ---- Dimensions - - const dimensionAttribute = marathonModule?.configuratorAttributes?.find((attribute) => - attribute?.features?.some((feature) => feature?.name === FEATURE_NAMES.DIMENSION_HEIGHT) - ); - - // -------- Height - - const heightMM = getQuantityValueFeature( - dimensionAttribute?.features, - FEATURE_NAMES.DIMENSION_HEIGHT, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - // -------- Width - - const minWidthMM = getQuantityValueFeature( - dimensionAttribute?.features, - FEATURE_NAMES.MIN_WIDTH, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - const maxWidthMM = getQuantityValueFeature( - dimensionAttribute?.features, - FEATURE_NAMES.MAX_WIDTH, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - // -------- Depth - - const minDepthMM = getQuantityValueFeature( - dimensionAttribute?.features, - FEATURE_NAMES.MIN_DEPTH, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - const maxDepthMM = getQuantityValueFeature( - dimensionAttribute?.features, - FEATURE_NAMES.MAX_DEPTH, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - // ---- Rules - - const rulesAttribute = marathonModule?.configuratorAttributes?.find((attribute) => - attribute?.features?.some((feature) => feature?.name === FEATURE_NAMES.TRIMMABLE) - ); - - // -------- Trimmable - - const trimmable = ( - rulesAttribute?.features?.find((feature) => feature?.name === FEATURE_NAMES.TRIMMABLE) as - | CsFeatureMultiselect - | undefined - )?.selections - ?.filter((x) => !!x) // Remove nulls and undefined values IF they exist - .map((x) => x as string); // Cast to string because we know there are no null/undefined values since we filtered - - // -------- Trim offset - - const trimOffsetBottomMM = getQuantityValueFeature( - rulesAttribute?.features, - FEATURE_NAMES.TRIM_OFFSET_BOTTOM, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - const trimOffsetTopMM = getQuantityValueFeature( - rulesAttribute?.features, - FEATURE_NAMES.TRIM_OFFSET_TOP, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - const trimOffsetLeftMM = getQuantityValueFeature( - rulesAttribute?.features, - FEATURE_NAMES.TRIM_OFFSET_LEFT, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); - - const trimOffsetRightMM = getQuantityValueFeature( - rulesAttribute?.features, - FEATURE_NAMES.TRIM_OFFSET_RIGHT, - FEATURE_NAMES.MM_ID, - numberFromMaybe - ); + const makeProductFromModule = ( + module: MarathonModule, + targetThumbnailUrl?: string | null, + currentRules?: NexusGenObjects['ModuleRules'] | null + ) => { + const rules = mergeRules(module, currentRules); + const sourceThumbnail = + module?.productPictures && module.productPictures.length > 0 + ? module?.productPictures[0]?.fullpath?.trim() + : undefined; return { - partNumber, - isImprintExtension: false, // TODO: Grab correct value - finishes: marathonModule?.finishes - ?.map((x) => x?.element?.partNumber) - .filter((x) => !!x) // Remove nulls and undefined values IF they exist - .map((x) => x as string), // Cast to string because we know there are no null/undefined values since we filtered - dimensions: { - height: { - millimeters: heightMM, - // Currently they don't provide in so we must convert from mm - inches: convertMmToInFormatted(`${heightMM}`) - }, - width: { - min: { - millimeters: minWidthMM, - // Currently they don't provide in so we must convert from mm - inches: convertMmToInFormatted(`${minWidthMM}`) - }, - max: { - millimeters: maxWidthMM, - // Currently they don't provide in so we must convert from mm - inches: convertMmToInFormatted(`${maxWidthMM}`) - } - }, - depth: { - min: { - millimeters: minDepthMM, - // Currently they don't provide in so we must convert from mm - inches: convertMmToInFormatted(`${minDepthMM}`) - }, - max: { - millimeters: maxDepthMM, - // Currently they don't provide in so we must convert from mm - inches: convertMmToInFormatted(`${maxDepthMM}`) - } - } - }, - rules: { - trimmable, - trimOffset: { - // Force undefined if zero - bottom: trimOffsetBottomMM || undefined, - top: trimOffsetTopMM || undefined, - left: trimOffsetLeftMM || undefined, - right: trimOffsetRightMM || undefined - }, - options: marathonModule?.options - ?.map((x) => x?.partNumber) - .filter((x) => !!x) // Remove nulls and undefined values IF they exist - .map((x) => x as string) // Cast to string because we know there are no null/undefined values since we filtered - } + partNumber: module?.partNumber?.trim() as string, + externalId: module?.id?.trim(), + description: module?.titleDescription?.trim() || undefined, + thumbnailUrl: makeThumbnailUrlAndQueue( + sourceThumbnail, + targetThumbnailUrl || `images/module/${module?.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` + ), + // bundleUrl: module?.bundlePath?.fullpath?.trim() || undefined, // FIX: Uncomment after also importing/uploading the image + isSubmodule: module?.isSubmodule || false, + hasPegs: module?.hasPegs || false, + isMat: module?.isMat || false, + // isExtension: module.isExtension || false,, TODO: Make sure they provide this info + shouldHideBasedOnWidth: + module?.shouldHideBasedOnWidth !== undefined && module?.shouldHideBasedOnWidth !== null + ? module?.shouldHideBasedOnWidth + : true, + alwaysDisplay: module?.alwaysDisplay || false, + isEdge: module?.isEdge || false, + rules + // TODO: Default left extension + // TODO: Default right extension + // TODO: attachmentToAppend: newRules?.rules. + // TODO: module attachments }; }; - const mergeRules = ( - marathonModule: MarathonModule, - currentRules?: NexusGenObjects['ModuleRules'] - ): NexusGenObjects['ModuleRules'] | undefined => { - const partNumber = marathonModule?.partNumber?.trim() || currentRules?.partNumber; - if (!partNumber) throw makeError('Cannot create rule without partNumber', 'ruleMergeMissingPartNumber'); - - const marathonRules = makeRulesFromMarathonModule(marathonModule); - - return currentRules - ? deepmerge(currentRules, marathonRules, { - // combine arrays using object equality (like in sets) - arrayMerge: (destinationArray, sourceArray) => [ - ...sourceArray, - ...destinationArray.filter((d) => sourceArray.every((s) => !isEqual(d, s))) - ] - }) - : marathonRules; - }; - - const syncProduct = async () => { + const syncProduct = async (skipDatabase?: boolean) => { if (!db) { throw new Error('db dependency was not provided'); } @@ -1003,6 +792,30 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (products && products.length > 0) { console.log(`Product page ${pageIndex + 1}, fetched ${products.length} products`); + products.forEach((product, i) => { + const module = product?.node; + const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + + makeFile(dir, path.join(`marathon/${module?.partNumber || i}.json`), module || {}); + + const rules = mergeRules(module); + makeFile(dir, path.join(`jsons/${module?.partNumber || i}.json`), rules || {}); + + const queueAppend = makeQueueAppendRulesFromMarathonModule(module); + + if (queueAppend?.append) + makeFile( + dir, + path.join(`jsons/${queueAppend.append.partNumber || `append-${i}`}.json`), + queueAppend.append + ); + + if (queueAppend?.queueModules && queueAppend.queueModules.length > 0) + queueAppend.queueModules.forEach((queueModule, j) => + makeFile(dir, path.join(`jsons/${queueModule.partNumber || `queuemodule-${j}`}.json`), queueModule) + ); + }); + const ids = products // Casting because we're explicitly filtering by only valid values .map((productEdge) => productEdge?.node?.id as string) @@ -1056,233 +869,195 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } ); - if (modulesToCreate && modulesToCreate.length > 0) { - console.log(`Batch creating ${modulesToCreate.length} products`); - try { - await db.$transaction(async (db) => { - await db.module.createMany({ - data: modulesToCreate.map((productEdge) => { - const module = productEdge?.node; - const rules = mergeRules(module); - const sourceThumbnail = - module?.productPictures && module.productPictures.length > 0 - ? module?.productPictures[0]?.fullpath?.trim() - : undefined; - return { - partNumber: module?.partNumber?.trim() as string, - externalId: module?.id?.trim(), - description: module?.titleDescription?.trim() || undefined, - thumbnailUrl: makeThumbnailUrlAndQueue( - sourceThumbnail, - `images/module/${module?.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` - ), - // bundleUrl: module?.bundlePath?.fullpath?.trim() || undefined, // FIX: Uncomment after also importing/uploading the image - isSubmodule: module?.isSubmodule || false, - hasPegs: module?.hasPegs || false, - isMat: module?.isMat || false, - // isExtension: module.isExtension || false,, TODO: Make sure they provide this info - shouldHideBasedOnWidth: - module?.shouldHideBasedOnWidth !== undefined && module?.shouldHideBasedOnWidth !== null - ? module?.shouldHideBasedOnWidth - : true, - alwaysDisplay: module?.alwaysDisplay || false, - isEdge: module?.isEdge || false, - rules, - finishId: existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || -1, - collectionId: - existingCollections.find((collection) => collection.externalId === module?.spCollection?.id) - ?.id || -1 - // TODO: Default left extension - // TODO: Default right extension - // TODO: attachmentToAppend: newRules?.rules. - // TODO: module attachments - }; - }) - }); + if (!skipDatabase) { + if (modulesToCreate && modulesToCreate.length > 0) { + console.log(`Batch creating ${modulesToCreate.length} products`); + try { + await db.$transaction(async (db) => { + await db.module.createMany({ + data: modulesToCreate.map((productEdge) => { + const module = productEdge?.node; + const product = makeProductFromModule(module); + return { + ...product, + finishId: + existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || -1, + collectionId: + existingCollections.find((collection) => collection.externalId === module?.spCollection?.id) + ?.id || -1 + }; + }) + }); - console.log(`Fetching recently created ${modulesToCreate.length} products`); - const recentlyCreatedModules = await db.module.findMany({ - where: { - externalId: { - in: modulesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) + console.log(`Fetching recently created ${modulesToCreate.length} products`); + const recentlyCreatedModules = await db.module.findMany({ + where: { + externalId: { + in: modulesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) + } + }, + select: { + id: true, + externalId: true } - }, - select: { - id: true, - externalId: true - } - }); + }); - console.log(`Batch creating ${recentlyCreatedModules.length} product categories`); + console.log(`Batch creating ${recentlyCreatedModules.length} product categories`); - const categoriesToCreate = modulesToCreate.flatMap((productEdge) => - productEdge?.node?.spCategories?.map((cat) => ({ - catExternalId: cat?.id, - catSlug: null, - moduleExternalId: productEdge?.node?.id - })) - ); - - const categoryAllToCreate = modulesToCreate.map((productEdge) => ({ - catSlug: 'all', - catExternalId: null, - moduleExternalId: productEdge?.node?.id - })); + const categoriesToCreate = modulesToCreate.flatMap((productEdge) => + productEdge?.node?.spCategories?.map((cat) => ({ + catExternalId: cat?.id, + catSlug: null, + moduleExternalId: productEdge?.node?.id + })) + ); - await db.moduleCategory.createMany({ - data: [...categoriesToCreate, ...categoryAllToCreate] - .filter((x) => !!x) - .map((catModule) => { - return { + const categoryAllToCreate = modulesToCreate.map((productEdge) => ({ + catSlug: 'all', + catExternalId: null, + moduleExternalId: productEdge?.node?.id + })); + + await db.moduleCategory.createMany({ + data: [...categoriesToCreate, ...categoryAllToCreate] + .filter((x) => !!x) + .map((catModule) => { + return { + moduleId: + recentlyCreatedModules.find((x) => x.externalId === catModule?.moduleExternalId)?.id || -1, + categoryId: + existingCategories.find((x) => + catModule?.catExternalId + ? x.externalId === catModule?.catExternalId + : x.slug === catModule?.catSlug + )?.id || -1 + }; + }) + }); + + console.log(`Batch creating ${recentlyCreatedModules.length} product types`); + await db.moduleType.createMany({ + data: modulesToCreate + .flatMap((productEdge) => + productEdge?.node?.spDrawerTypes?.map((type) => ({ + typeExternalId: type?.id, + moduleExternalId: productEdge?.node?.id + })) + ) + .filter((x) => !!x) + .map((typeModule) => ({ moduleId: - recentlyCreatedModules.find((x) => x.externalId === catModule?.moduleExternalId)?.id || -1, - categoryId: - existingCategories.find((x) => - catModule?.catExternalId - ? x.externalId === catModule?.catExternalId - : x.slug === catModule?.catSlug - )?.id || -1 - }; - }) - }); - - console.log(`Batch creating ${recentlyCreatedModules.length} product types`); - await db.moduleType.createMany({ - data: modulesToCreate - .flatMap((productEdge) => - productEdge?.node?.spDrawerTypes?.map((type) => ({ - typeExternalId: type?.id, - moduleExternalId: productEdge?.node?.id + recentlyCreatedModules.find((x) => x.externalId === typeModule?.moduleExternalId)?.id || -1, + typeId: existingTypes.find((x) => x.externalId === typeModule?.typeExternalId)?.id || -1 })) - ) - .filter((x) => !!x) - .map((typeModule) => ({ - moduleId: - recentlyCreatedModules.find((x) => x.externalId === typeModule?.moduleExternalId)?.id || -1, - typeId: existingTypes.find((x) => x.externalId === typeModule?.typeExternalId)?.id || -1 - })) + }); }); - }); - } catch (err) { - logging.error(err, 'Error when batch creating products', { - modulesToCreate: modulesToCreate?.map((x) => x?.node).filter((x) => !!x), - existingCollections, - existingFinishes - }); + } catch (err) { + logging.error(err, 'Error when batch creating products', { + modulesToCreate: modulesToCreate?.map((x) => x?.node).filter((x) => !!x), + existingCollections, + existingFinishes + }); + } + } else { + console.log(`No module to create`); } - } else { - console.log(`No module to create`); - } - for (let i = 0; i < modulesToUpdate.length; i++) { - const productEdge = modulesToUpdate[i]; + for (let i = 0; i < modulesToUpdate.length; i++) { + const productEdge = modulesToUpdate[i]; - const moduleEdge = productEdge?.node; - if (!moduleEdge?.id) continue; + const moduleEdge = productEdge?.node; + if (!moduleEdge?.id) continue; - const existingModule = existingModules.find((x) => x.externalId === moduleEdge.id); - if (!existingModule) continue; + const existingModule = existingModules.find((x) => x.externalId === moduleEdge.id); + if (!existingModule) continue; - console.log(`Updating module #${i + 1} id: ${moduleEdge.id} of ${modulesToUpdate.length}`); - const rules = existingModule?.rules as NexusGenObjects['ModuleRules'] | undefined; + console.log(`Updating module #${i + 1} id: ${moduleEdge.id} of ${modulesToUpdate.length}`); - await db.$transaction(async (db) => { - // Sync categories - - // Delete existing categories to re create - await db.moduleCategory.deleteMany({ - where: { module: { externalId: moduleEdge.id }, category: { slug: { not: 'all' } } } - }); + await db.$transaction(async (db) => { + // Sync categories - // If there are categories for this module - if (moduleEdge.spCategories && moduleEdge.spCategories.length > 0) { - // Create them - await db.moduleCategory.createMany({ - data: moduleEdge.spCategories.map((cat) => ({ - moduleId: existingModule?.id || -1, - categoryId: existingCategories.find((x) => x.slug === cat?.slug?.trim())?.id || -1 - })) + // Delete existing categories to re create + await db.moduleCategory.deleteMany({ + where: { module: { externalId: moduleEdge.id }, category: { slug: { not: 'all' } } } }); - } - // Sync type + // If there are categories for this module + if (moduleEdge.spCategories && moduleEdge.spCategories.length > 0) { + // Create them + await db.moduleCategory.createMany({ + data: moduleEdge.spCategories.map((cat) => ({ + moduleId: existingModule?.id || -1, + categoryId: existingCategories.find((x) => x.slug === cat?.slug?.trim())?.id || -1 + })) + }); + } - // Delete existing types to then create - await db.moduleType.deleteMany({ where: { module: { externalId: moduleEdge.id } } }); + // Sync type - // If there are types for this module - if (moduleEdge.spDrawerTypes && moduleEdge.spDrawerTypes.length > 0) { - // Create them - await db.moduleType.createMany({ - data: moduleEdge.spDrawerTypes.map((type) => ({ - moduleId: existingModule?.id || -1, - typeId: existingTypes.find((x) => x.externalId === type?.id)?.id || -1 - })) - }); - } + // Delete existing types to then create + await db.moduleType.deleteMany({ where: { module: { externalId: moduleEdge.id } } }); - // TODO: module attachments - - const newRules = mergeRules(moduleEdge, rules); - const sourceThumbnail = - moduleEdge.productPictures && moduleEdge.productPictures.length > 0 - ? moduleEdge.productPictures[0]?.fullpath?.trim() - : undefined; - - await db.module.update({ - // Casting because we're sure it exists due to previous check - where: { externalId: moduleEdge.id as string }, - data: { - externalId: moduleEdge.id?.trim(), - description: moduleEdge.titleDescription?.trim() || undefined, - thumbnailUrl: makeThumbnailUrlAndQueue(sourceThumbnail, existingModule.thumbnailUrl), - // bundleUrl: module.bundlePath?.fullpath?.trim() || undefined, // FIX: Uncomment after also importing/uploading the image - isSubmodule: moduleEdge.isSubmodule || undefined, - hasPegs: moduleEdge.hasPegs || undefined, - isMat: moduleEdge.isMat || undefined, - // isExtension: module.isExtension || false, - shouldHideBasedOnWidth: - moduleEdge.shouldHideBasedOnWidth !== undefined && moduleEdge.shouldHideBasedOnWidth !== null - ? moduleEdge.shouldHideBasedOnWidth - : undefined, - // alwaysDisplay: module.alwaysDisplay || undefined, - // isEdge: module.isEdge || undefined, - rules: newRules, - - finish: moduleEdge.spFinish?.slug?.trim() - ? { - connect: { - slug: moduleEdge.spFinish.slug.trim() + // If there are types for this module + if (moduleEdge.spDrawerTypes && moduleEdge.spDrawerTypes.length > 0) { + // Create them + await db.moduleType.createMany({ + data: moduleEdge.spDrawerTypes.map((type) => ({ + moduleId: existingModule?.id || -1, + typeId: existingTypes.find((x) => x.externalId === type?.id)?.id || -1 + })) + }); + } + + // TODO: module attachments + + const product = makeProductFromModule( + moduleEdge, + existingModule?.thumbnailUrl, + // Casting since it's a json type and it doesn't know, but we know + existingModule?.rules as NexusGenObjects['ModuleRules'] | undefined + ); + + await db.module.update({ + // Casting because we're sure it exists due to previous check + where: { externalId: moduleEdge.id as string }, + data: { + ...product, + finish: moduleEdge.spFinish?.slug?.trim() + ? { + connect: { + slug: moduleEdge.spFinish.slug.trim() + } } - } - : undefined, - collection: moduleEdge.spCollection?.slug?.trim() - ? { - connect: { - slug: moduleEdge.spCollection.slug.trim() + : undefined, + collection: moduleEdge.spCollection?.slug?.trim() + ? { + connect: { + slug: moduleEdge.spCollection.slug.trim() + } } - } - : undefined, - // TODO: Default left extension - defaultLeftExtension: newRules?.extensions?.left - ? { - connect: { - partNumber: newRules.extensions.left + : undefined, + // TODO: Default left extension + defaultLeftExtension: product.rules?.extensions?.left + ? { + connect: { + partNumber: product.rules.extensions.left + } } - } - : undefined, - // TODO: Default right extension - defaultRightExtension: newRules?.extensions?.right - ? { - connect: { - partNumber: newRules.extensions.right + : undefined, + // TODO: Default right extension + defaultRightExtension: product.rules?.extensions?.right + ? { + connect: { + partNumber: product.rules.extensions.right + } } - } - : undefined - // TODO: attachmentToAppend: newRules?.rules. - } + : undefined + // TODO: attachmentToAppend: newRules?.rules. + } + }); }); - }); + } } if (modulesToCreate && modulesToCreate.length === 0 && modulesToUpdate && modulesToUpdate.length === 0) { @@ -1324,16 +1099,16 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('products'); }; - const syncData = async () => { + const syncData = async (skipDatabase?: boolean) => { try { console.time('apiSync'); - await syncCategory(); - await syncCollection(); - await syncDrawerType(); - await syncFinish(); + await syncCategory(skipDatabase); + await syncCollection(skipDatabase); + await syncDrawerType(skipDatabase); + await syncFinish(skipDatabase); // Always leave products for last!! - await syncProduct(); + await syncProduct(skipDatabase); console.timeEnd('apiSync'); console.time('storageSync'); diff --git a/src/services/marathon/parsing/constants.ts b/src/services/marathon/parsing/constants.ts new file mode 100644 index 0000000..6789d83 --- /dev/null +++ b/src/services/marathon/parsing/constants.ts @@ -0,0 +1,38 @@ +import { GetProductListingQuery } from '../../../generated/graphql'; + +export const FEATURE_NAMES = { + DIMENSION_HEIGHT: 'height', + MM_ID: 'mm', + IN_ID: 'in', + MIN_WIDTH: 'width_min', + MAX_WIDTH: 'width_max', + MIN_DEPTH: 'depth_min', + MAX_DEPTH: 'depth_max', + TRIMMABLE: 'trimmable', + TRIM_OFFSET_BOTTOM: 'trim_offset_bottom', + TRIM_OFFSET_TOP: 'trim_offset_top', + TRIM_OFFSET_LEFT: 'trim_offset_left', + TRIM_OFFSET_RIGHT: 'trim_offset_right', + DIMENSION_ATTRIBUTE: 'Dimensions - Drawer Organizers', + QUEUE_MODULES_ATTRIBUTE: 'Queue Modules for SpiceRack', + QUEUE_APPEND_ATTRIBUTE: 'Queue Append for SpiceRack', + RULES_ATTRIBUTE: 'Rules for Options', + EXT_PART: 'ext_part', + EXT_FINISHES: 'ext_finishes', + ROTATION: 'rotation', + ANGLE: 'angle', + FULL_DEPTH: 'fullDepth', + IS_FILLER: 'isFiller', + EXT_SIDE_LEFT: 'imprint_ext_side_left', + EXT_SIDE_RIGHT: 'imprint_ext_side_right', + QUEUE_MODULES: 'queue_modules', + QUEUE_APPEND: 'queue_append' +}; + +export type MarathonModule = NonNullable< + NonNullable['edges']>[0] +>['node']; + +export type ConfiguratorAttribute = NonNullable['configuratorAttributes']>[number]; + +export type FeatureList = NonNullable['features']; diff --git a/src/services/marathon/parsing/parseRules.ts b/src/services/marathon/parsing/parseRules.ts new file mode 100644 index 0000000..9a0bb79 --- /dev/null +++ b/src/services/marathon/parsing/parseRules.ts @@ -0,0 +1,334 @@ +import deepmerge from 'deepmerge'; +import { isEqual } from 'lodash'; +import { CsFeatureInput } from '../../../generated/graphql'; +import { NexusGenObjects } from '../../../generated/nexus'; +import { convertMmToInFormatted } from '../../../utils/conversion'; +import { makeError } from '../../../utils/exception'; +import { FeatureList, FEATURE_NAMES, MarathonModule } from './constants'; +import { + getQuantityValueFeature, + numberFromMaybe, + getBooleanSelectFeature, + getInputFeature, + getMultiSelectFeature, + getNumericFeature, + numberUndefinedFromMaybe +} from './parseValues'; + +/** + * Makes a dimension rule object from a given "configurator attribute" from their api + */ +export const makeDimensionRulesFromAttribute = ( + featureList?: FeatureList +): NexusGenObjects['ModuleRules']['dimensions'] => { + // -------- Height + + const heightMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.DIMENSION_HEIGHT, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + // -------- Width + + const minWidthMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.MIN_WIDTH, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + const maxWidthMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.MAX_WIDTH, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + // -------- Depth + + const minDepthMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.MIN_DEPTH, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + const maxDepthMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.MAX_DEPTH, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + return { + height: { + millimeters: heightMM, + // Currently they don't provide in so we must convert from mm + inches: convertMmToInFormatted(`${heightMM}`) + }, + width: { + min: { + millimeters: minWidthMM, + // Currently they don't provide in so we must convert from mm + inches: convertMmToInFormatted(`${minWidthMM}`) + }, + max: { + millimeters: maxWidthMM, + // Currently they don't provide in so we must convert from mm + inches: convertMmToInFormatted(`${maxWidthMM}`) + } + }, + depth: { + min: { + millimeters: minDepthMM, + // Currently they don't provide in so we must convert from mm + inches: convertMmToInFormatted(`${minDepthMM}`) + }, + max: { + millimeters: maxDepthMM, + // Currently they don't provide in so we must convert from mm + inches: convertMmToInFormatted(`${maxDepthMM}`) + } + } + }; +}; + +export const makeRulesObjectFromAttribute = ( + featureList?: FeatureList, + getOptions?: () => NonNullable['options'] +): NexusGenObjects['ModuleRules']['rules'] => { + // -------- Trimmable + + const trimmable = getMultiSelectFeature(featureList, FEATURE_NAMES.TRIMMABLE); + + // -------- Trim offset + + const trimOffsetBottomMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.TRIM_OFFSET_BOTTOM, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + const trimOffsetTopMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.TRIM_OFFSET_TOP, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + const trimOffsetLeftMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.TRIM_OFFSET_LEFT, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + const trimOffsetRightMM = getQuantityValueFeature( + featureList, + FEATURE_NAMES.TRIM_OFFSET_RIGHT, + FEATURE_NAMES.MM_ID, + numberFromMaybe + ); + + const trimOffset = { + // Force undefined if zero + bottom: trimOffsetBottomMM || undefined, + top: trimOffsetTopMM || undefined, + left: trimOffsetLeftMM || undefined, + right: trimOffsetRightMM || undefined + }; + + // -------- Angle/rotation + + const rotation = getNumericFeature(featureList, FEATURE_NAMES.ROTATION, numberUndefinedFromMaybe); + const angle = getNumericFeature(featureList, FEATURE_NAMES.ANGLE, numberUndefinedFromMaybe); + + // -------- Booleans + + const isFiller = getBooleanSelectFeature(featureList, FEATURE_NAMES.IS_FILLER); + const fullDepth = getBooleanSelectFeature(featureList, FEATURE_NAMES.FULL_DEPTH); + + const append = getInputFeature(featureList, FEATURE_NAMES.QUEUE_APPEND); + const queueModules = getMultiSelectFeature(featureList, FEATURE_NAMES.QUEUE_MODULES); + + return { + trimmable, + trimOffset: Object.entries(trimOffset).some((x) => x[1] !== undefined) ? trimOffset : undefined, + // requiredNetInterior, + rotation, + angle, + fullDepth, + isFiller, + queue: + append || queueModules + ? { + append, + // We know that if there's an append or queue modules, it's not undefined + modules: queueModules as string[] + } + : undefined, + options: + // If this module has extensions, its options will go under the extensions parent. So we ignore it here + !featureList?.some( + (feature) => feature?.name === FEATURE_NAMES.EXT_SIDE_LEFT || feature?.name === FEATURE_NAMES.EXT_SIDE_RIGHT + ) && getOptions + ? getOptions() + : undefined + }; +}; + +const makeRuleExtensionsFromAttribute = ( + featureList?: FeatureList, + getOptions?: () => NonNullable['options'] +): NexusGenObjects['ModuleRules']['extensions'] | undefined => { + // Remove left/right feature that only contain left/right text in it + const extensionFeatureList = featureList?.filter( + (x) => + !( + (x?.name === FEATURE_NAMES.EXT_SIDE_LEFT && (x as CsFeatureInput)?.text === 'left') || + (x?.name === FEATURE_NAMES.EXT_SIDE_RIGHT && (x as CsFeatureInput)?.text === 'right') + ) + ); + + const left = getInputFeature(extensionFeatureList, FEATURE_NAMES.EXT_SIDE_LEFT); + const right = getInputFeature(extensionFeatureList, FEATURE_NAMES.EXT_SIDE_RIGHT); + + if (!left && !right) return undefined; + + return { + left, + right, + options: getOptions && getOptions() + }; +}; + +export const makeRulesWithAttributes = ( + featureList: FeatureList, + getPartNumber: () => string | undefined, + isImprintExtension?: boolean, + getFinishes?: () => NexusGenObjects['ModuleRules']['finishes'], + getOptions?: () => NonNullable['options'] +): NexusGenObjects['ModuleRules'] => { + const dimensions = makeDimensionRulesFromAttribute(featureList); + // If this module has extensions, its "options" goes under the extensions + const rules = makeRulesObjectFromAttribute(featureList, getOptions); + const extensions = makeRuleExtensionsFromAttribute(featureList, getOptions); + + return { + partNumber: getPartNumber() || '', + isImprintExtension: !!isImprintExtension, + finishes: getFinishes && getFinishes(), + dimensions, + rules, + extensions + }; +}; + +const makeRulesFromMarathonModule = (marathonModule: MarathonModule): NexusGenObjects['ModuleRules'] => { + const partNumber = marathonModule?.partNumber?.trim(); + if (!partNumber) throw makeError('Cannot create rule without partNumber', 'ruleMergeMissingPartNumber'); + + const specialAttributes = [ + FEATURE_NAMES.EXT_SIDE_LEFT, + FEATURE_NAMES.EXT_SIDE_RIGHT, + FEATURE_NAMES.QUEUE_MODULES_ATTRIBUTE, + FEATURE_NAMES.QUEUE_APPEND_ATTRIBUTE + ]; + + // Merge all attributes that aren't the special attributes into a single one + const catchAllFeatureList = marathonModule?.configuratorAttributes + ?.filter( + (attribute) => !specialAttributes.some((specialAttribute) => attribute?.description?.includes(specialAttribute)) + ) + .flatMap((x) => x?.features); + + return makeRulesWithAttributes( + catchAllFeatureList as FeatureList, + () => partNumber, + false, + () => + marathonModule?.finishes + ?.map((x) => x?.element?.partNumber) + .filter((x) => !!x) // Remove nulls and undefined values IF they exist + .map((x) => x as string), // Cast to string because we know there are no null/undefined values since we filtered + () => + marathonModule?.options + ?.map((x) => x?.partNumber) + .filter((x) => !!x) // Remove nulls and undefined values IF they exist + .map((x) => x as string) // Cast to string because we know there are no null/undefined values since we filtered + ); +}; + +// TODO: Make a similar of this for extensions +export const makeQueueAppendRulesFromMarathonModule = ( + marathonModule: MarathonModule +): + | { + append?: Partial; + queueModules?: Partial[]; + } + | undefined => { + // ---- Queue + const queueModules = marathonModule?.configuratorAttributes + ?.filter((attribute) => attribute?.description?.includes(FEATURE_NAMES.QUEUE_MODULES_ATTRIBUTE)) + ?.map((queueModuleAttribute) => + makeRulesWithAttributes( + queueModuleAttribute?.features, + () => + getInputFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)), + false, + () => + getMultiSelectFeature(queueModuleAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) + ) + ) + ); + + // ---- Append + const appendModulesAttribute = marathonModule?.configuratorAttributes?.find( + (attribute) => attribute?.description === FEATURE_NAMES.QUEUE_APPEND_ATTRIBUTE + ); + + if (!queueModules && !appendModulesAttribute) return undefined; + + return { + append: appendModulesAttribute + ? makeRulesWithAttributes( + appendModulesAttribute?.features, + () => + getInputFeature(appendModulesAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) + ), + false, + () => + getMultiSelectFeature(appendModulesAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) + ) + ) + : undefined, + queueModules + }; +}; + +export const mergeRules = ( + marathonModule: MarathonModule, + currentRules?: NexusGenObjects['ModuleRules'] | null +): NexusGenObjects['ModuleRules'] | undefined => { + const partNumber = marathonModule?.partNumber?.trim() || currentRules?.partNumber; + if (!partNumber) throw makeError('Cannot create rule without partNumber', 'ruleMergeMissingPartNumber'); + + const marathonRules = makeRulesFromMarathonModule(marathonModule); + + return currentRules + ? deepmerge(currentRules, marathonRules, { + // combine arrays using object equality (like in sets) + arrayMerge: (destinationArray, sourceArray) => [ + ...sourceArray, + ...destinationArray.filter((d) => sourceArray.every((s) => !isEqual(d, s))) + ] + }) + : marathonRules; +}; diff --git a/src/services/marathon/parsing/parseValues.ts b/src/services/marathon/parsing/parseValues.ts new file mode 100644 index 0000000..4c50eae --- /dev/null +++ b/src/services/marathon/parsing/parseValues.ts @@ -0,0 +1,123 @@ +import { + CsFeatureQuantityValue, + CsFeatureMultiselect, + CsFeatureInput, + CsFeatureNumeric, + CsFeatureBooleanSelect +} from '../../../generated/graphql'; +import { convertInToMmFormatted, convertMmToInFormatted } from '../../../utils/conversion'; +import { makeError } from '../../../utils/exception'; +import { FeatureList, FEATURE_NAMES } from './constants'; + +/** + * Tries to grab a value of @param featureName from a feature list + */ +export const getQuantityValueFeature = ( + featureList: FeatureList, + featureName: string, + featureUnitId: string, + format?: (value?: unknown) => TResult +): TResult => { + // Get the feature with the name we want from the list + const feature = featureList?.find((feature) => feature?.name === featureName) as CsFeatureQuantityValue | undefined; + + // If unit is wrong + if (feature?.quantityvalue?.unit?.id && feature.quantityvalue.unit.id !== featureUnitId) { + if (featureUnitId === FEATURE_NAMES.MM_ID && feature.quantityvalue.unit.id === FEATURE_NAMES.IN_ID) { + const inchValue = convertInToMmFormatted(`${feature.quantityvalue.value || 0}`); + + return format ? format(inchValue) : (inchValue as unknown as TResult); + } else if (featureUnitId === FEATURE_NAMES.IN_ID && feature.quantityvalue.unit.id === FEATURE_NAMES.MM_ID) { + const mmValue = convertMmToInFormatted(`${feature.quantityvalue.value || 0}`); + + return format ? format(mmValue) : (mmValue as unknown as TResult); + } else { + throw makeError( + `Expected ${featureName} feature as ${featureUnitId}, but was returned as "${feature?.quantityvalue?.unit?.id}" with value "${feature.quantityvalue.value}"`, + 'ruleMergeFeatureQuantityUnit' + ); + } + } + + // Format or return plain + return format ? format(feature?.quantityvalue?.value) : (feature?.quantityvalue?.value as unknown as TResult); +}; + +export const getMultiSelectFeature = ( + featureList: FeatureList, + featureName: string | ((feature: NonNullable[number]) => boolean | undefined) +): string[] | undefined => + ( + featureList?.find((feature) => + typeof featureName === 'string' ? feature?.name === featureName : featureName(feature) + ) as CsFeatureMultiselect | undefined + )?.selections + ?.filter((x) => !!x) // Remove nulls and undefined values IF they exist + .map((x) => x as string); + +export const getInputFeature = ( + featureList: FeatureList, + featureName: string | ((feature: NonNullable[number]) => boolean | undefined) +): string | undefined => { + const stringValue = ( + featureList?.find((feature) => + typeof featureName === 'string' ? feature?.name === featureName : featureName(feature) + ) as CsFeatureInput | undefined + )?.text; + + return stringValue !== null ? stringValue : undefined; +}; + +export const getNumericFeature = ( + featureList: FeatureList, + featureName: string | ((feature: NonNullable[number]) => boolean | undefined), + format?: (value?: unknown) => TResult +) => { + const stringValue = ( + featureList?.find((feature) => + typeof featureName === 'string' ? feature?.name === featureName : featureName(feature) + ) as CsFeatureNumeric | undefined + )?.number as unknown as TResult; + + return format ? format(stringValue) : (stringValue as unknown as TResult); +}; + +export const getBooleanSelectFeature = ( + featureList: FeatureList, + featureName: string | ((feature: NonNullable[number]) => boolean | undefined) +): boolean | undefined => { + const boolValue = ( + featureList?.find((feature) => + typeof featureName === 'string' ? feature?.name === featureName : featureName(feature) + ) as CsFeatureBooleanSelect | undefined + )?.checked; + + return boolValue !== null ? boolValue : undefined; +}; + +/** + * Tries to safely convert a param to a number + */ +export const numberFromMaybe = (originalValue?: string | number | null | unknown): number => { + let value = originalValue; + + if (typeof value !== 'number') value = parseFloat(`${value}`); + + // Casting because we convert the value above + return value && !isNaN(value as number) ? (value as number) : 0; +}; + +export const numberUndefinedFromMaybe = (originalValue?: string | number | null | unknown): number | undefined => { + if (!originalValue) return undefined; + let value = originalValue; + + if (typeof value !== 'number') value = parseFloat(`${value}`); + + if (value && !isNaN(value as number)) { + // Casting because we convert the value above + return value as number; + } else { + // console.log(`Value ${originalValue} converted to unexpected ${value}`); + return undefined; + } +}; diff --git a/src/utils/conversion.ts b/src/utils/conversion.ts index 75b2e8b..3400639 100644 --- a/src/utils/conversion.ts +++ b/src/utils/conversion.ts @@ -84,7 +84,11 @@ export const convertMmToIn = (mm_o: string) => { }; export const convertMmToInFormatted = (value: string) => { - const conversion = convertMmToIn(value); + let conversion = convertMmToIn(value); + + // Dirty fix to remove null entries + conversion = conversion.map((x) => (`${x}` === 'null' ? 0 : x)); + if (conversion[1] || conversion[2]) { return `${conversion[0]}" ${conversion[1]}/${conversion[2]}`; } else { diff --git a/src/utils/file.ts b/src/utils/file.ts index 94fbde8..d541a5f 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -1,4 +1,5 @@ import path from 'path'; +import fs from 'fs'; export const isSameExtesion = (...paths: string[]) => { if (!paths || paths.length <= 0) return false; @@ -17,3 +18,13 @@ export const replaceExtension = (original: string, replaceWith: string) => { return originalExt ? original.replace(originalExt, newExt) : original + newExt; }; + +export const makeFile = (dir: string, fileName: string, content: any) => { + fs.mkdir(dir, { recursive: true }, (err) => { + if (err) throw err; + + fs.writeFile(path.join(dir, fileName), JSON.stringify(content, null, 2), { flag: 'w' }, (err) => { + if (err) throw err; + }); + }); +}; From eb811bb34363667ddd21400755aad9006e0a068c Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Fri, 22 Apr 2022 16:11:41 -0300 Subject: [PATCH 05/13] fix: updates sync product so it updates all parent modules if neede --- graphql.schema.json | 808 +++++++++++++++++++- src/generated/graphql.ts | 125 ++- src/generated/nexus.d.ts | 125 ++- src/generated/schema.graphql | 51 +- src/schema/moduleRules.ts | 79 +- src/services/marathon/fragments.ts | 10 + src/services/marathon/index.ts | 623 +++++++-------- src/services/marathon/parsing/constants.ts | 16 +- src/services/marathon/parsing/parseRules.ts | 411 +++++++--- src/utils/types.ts | 4 + 10 files changed, 1794 insertions(+), 458 deletions(-) create mode 100644 src/utils/types.ts diff --git a/graphql.schema.json b/graphql.schema.json index d48854c..20847dd 100644 --- a/graphql.schema.json +++ b/graphql.schema.json @@ -6,6 +6,80 @@ "mutationType": null, "subscriptionType": null, "types": [ + { + "kind": "OBJECT", + "name": "AlternativeConnection", + "description": null, + "fields": [ + { + "name": "edges", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "AlternativeEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "The total count of all queryable objects for this schema listing", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AlternativeEdge", + "description": null, + "fields": [ + { + "name": "cursor", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "object_alternative", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "SCALAR", "name": "Boolean", @@ -35,6 +109,11 @@ "name": "property_object", "ofType": null }, + { + "kind": "OBJECT", + "name": "property_select", + "ofType": null + }, { "kind": "OBJECT", "name": "property_text", @@ -318,6 +397,184 @@ "name": "Query", "description": null, "fields": [ + { + "name": "getAlternative", + "description": null, + "args": [ + { + "name": "defaultLanguage", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fullpath", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "object_alternative", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "getAlternativeListing", + "description": null, + "args": [ + { + "name": "after", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultLanguage", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filter", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "first", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fullpaths", + "description": "Comma separated list of fullpath", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ids", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "published", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortBy", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sortOrder", + "description": "Sort by ASC or DESC, use the same position as the sortBy argument for each column to sort by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AlternativeConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "getProduct", "description": null, @@ -2502,15 +2759,40 @@ "deprecationReason": null }, { - "name": "filename", + "name": "dimensions", "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, + "args": [ + { + "name": "thumbnail", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "dimensions", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filename", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, "deprecationReason": null }, { @@ -2529,6 +2811,18 @@ "name": "fullpath", "description": null, "args": [ + { + "name": "format", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "thumbnail", "description": null, @@ -4941,6 +5235,41 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "dimensions", + "description": null, + "fields": [ + { + "name": "height", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "width", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INTERFACE", "name": "element", @@ -4963,6 +5292,11 @@ "interfaces": [], "enumValues": null, "possibleTypes": [ + { + "kind": "OBJECT", + "name": "object_alternative", + "ofType": null + }, { "kind": "OBJECT", "name": "object_product", @@ -4992,7 +5326,7 @@ }, { "kind": "OBJECT", - "name": "element_metadata_item_621f7745f2ed6", + "name": "element_metadata_item_6262fc65db489", "description": null, "fields": [ { @@ -5081,6 +5415,11 @@ "interfaces": null, "enumValues": null, "possibleTypes": [ + { + "kind": "OBJECT", + "name": "object_alternative", + "ofType": null + }, { "kind": "OBJECT", "name": "object_product", @@ -5108,6 +5447,287 @@ } ] }, + { + "kind": "OBJECT", + "name": "object_alternative", + "description": null, + "fields": [ + { + "name": "_siblings", + "description": null, + "args": [ + { + "name": "objectTypes", + "description": "list of object types (object, variant, folder)", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "object_tree", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bundlePath", + "description": null, + "args": [], + "type": { + "kind": "UNION", + "name": "object_alternative_bundlePath", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "children", + "description": null, + "args": [ + { + "name": "objectTypes", + "description": "list of object types (object, variant, folder)", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "object_tree", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "childrenSortBy", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "classname", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasPegs", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "index", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "modificationDate", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "objectType", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "parent", + "description": null, + "args": [], + "type": { + "kind": "UNION", + "name": "object_tree", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "properties", + "description": null, + "args": [ + { + "name": "keys", + "description": "comma separated list of key names", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "ElementProperty", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tags", + "description": null, + "args": [ + { + "name": "name", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "element_tag", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "element", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "object_alternative_bundlePath", + "description": "pseudo class for field bundlePath", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "asset", + "ofType": null + } + ] + }, { "kind": "OBJECT", "name": "object_product", @@ -5146,6 +5766,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "alternative", + "description": null, + "args": [], + "type": { + "kind": "UNION", + "name": "object_product_alternative", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "alwaysDisplay", "description": null, @@ -5392,6 +6024,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "objectType", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "options", "description": null, @@ -5481,6 +6125,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "secondaryBundlePath", + "description": null, + "args": [], + "type": { + "kind": "UNION", + "name": "object_product_secondaryBundlePath", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "shortDescription", "description": null, @@ -5614,6 +6270,22 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "UNION", + "name": "object_product_alternative", + "description": "pseudo class for field alternative", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "object_alternative", + "ofType": null + } + ] + }, { "kind": "UNION", "name": "object_product_bundlePath", @@ -5656,7 +6328,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "element_metadata_item_621f7745f2ed6", + "name": "element_metadata_item_6262fc65db489", "ofType": null } }, @@ -5701,6 +6373,22 @@ } ] }, + { + "kind": "UNION", + "name": "object_product_secondaryBundlePath", + "description": "pseudo class for field secondaryBundlePath", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "asset", + "ofType": null + } + ] + }, { "kind": "UNION", "name": "object_product_spCategories", @@ -5932,6 +6620,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "objectType", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "parent", "description": null, @@ -6245,6 +6945,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "objectType", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "parent", "description": null, @@ -6574,6 +7286,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "objectType", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "parent", "description": null, @@ -6891,6 +7615,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "objectType", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "parent", "description": null, @@ -7014,6 +7750,11 @@ "interfaces": null, "enumValues": null, "possibleTypes": [ + { + "kind": "OBJECT", + "name": "object_alternative", + "ofType": null + }, { "kind": "OBJECT", "name": "object_product", @@ -7135,6 +7876,53 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "property_select", + "description": null, + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "text", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "property_text", diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index 74a595f..6d9b8ce 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -12,7 +12,20 @@ export type Scalars = { Float: number; }; -export type ElementProperty = Property_Checkbox | Property_Object | Property_Text; +export type AlternativeConnection = { + __typename?: 'AlternativeConnection'; + edges?: Maybe>>; + /** The total count of all queryable objects for this schema listing */ + totalCount?: Maybe; +}; + +export type AlternativeEdge = { + __typename?: 'AlternativeEdge'; + cursor?: Maybe; + node?: Maybe; +}; + +export type ElementProperty = Property_Checkbox | Property_Object | Property_Select | Property_Text; export type InputQuantityValue = { __typename?: 'InputQuantityValue'; @@ -60,6 +73,8 @@ export type QuantityValueUnit = { export type Query = { __typename?: 'Query'; + getAlternative?: Maybe; + getAlternativeListing?: Maybe; getProduct?: Maybe; getProductListing?: Maybe; getSpCategory?: Maybe; @@ -73,6 +88,26 @@ export type Query = { }; +export type QueryGetAlternativeArgs = { + defaultLanguage?: InputMaybe; + fullpath?: InputMaybe; + id?: InputMaybe; +}; + + +export type QueryGetAlternativeListingArgs = { + after?: InputMaybe; + defaultLanguage?: InputMaybe; + filter?: InputMaybe; + first?: InputMaybe; + fullpaths?: InputMaybe; + ids?: InputMaybe; + published?: InputMaybe; + sortBy?: InputMaybe>>; + sortOrder?: InputMaybe>>; +}; + + export type QueryGetProductArgs = { defaultLanguage?: InputMaybe; fullpath?: InputMaybe; @@ -230,6 +265,7 @@ export type Asset = { children?: Maybe>>; creationDate?: Maybe; data?: Maybe; + dimensions?: Maybe; filename?: Maybe; filesize?: Maybe; fullpath?: Maybe; @@ -251,7 +287,13 @@ export type AssetDataArgs = { }; +export type AssetDimensionsArgs = { + thumbnail?: InputMaybe; +}; + + export type AssetFullpathArgs = { + format?: InputMaybe; thumbnail?: InputMaybe; }; @@ -517,12 +559,18 @@ export type CsGroup = { name?: Maybe; }; +export type Dimensions = { + __typename?: 'dimensions'; + height?: Maybe; + width?: Maybe; +}; + export type Element = { id?: Maybe; }; -export type Element_Metadata_Item_621f7745f2ed6 = { - __typename?: 'element_metadata_item_621f7745f2ed6'; +export type Element_Metadata_Item_6262fc65db489 = { + __typename?: 'element_metadata_item_6262fc65db489'; name?: Maybe; value?: Maybe; }; @@ -534,11 +582,53 @@ export type Element_Tag = { path?: Maybe; }; -export type Hotspot_Metadata_Object = Object_Product | Object_SpCategory | Object_SpCollection | Object_SpDrawerTypes | Object_SpFinish; +export type Hotspot_Metadata_Object = Object_Alternative | Object_Product | Object_SpCategory | Object_SpCollection | Object_SpDrawerTypes | Object_SpFinish; + +export type Object_Alternative = Element & { + __typename?: 'object_alternative'; + _siblings?: Maybe>>; + bundlePath?: Maybe; + children?: Maybe>>; + childrenSortBy?: Maybe; + classname?: Maybe; + hasPegs?: Maybe; + id?: Maybe; + index?: Maybe; + key?: Maybe; + modificationDate?: Maybe; + objectType?: Maybe; + parent?: Maybe; + properties?: Maybe>>; + tags?: Maybe>>; +}; + + +export type Object_Alternative_SiblingsArgs = { + objectTypes?: InputMaybe>>; +}; + + +export type Object_AlternativeChildrenArgs = { + objectTypes?: InputMaybe>>; +}; + + +export type Object_AlternativePropertiesArgs = { + keys?: InputMaybe>>; +}; + + +export type Object_AlternativeTagsArgs = { + name?: InputMaybe; +}; + +/** pseudo class for field bundlePath */ +export type Object_Alternative_BundlePath = Asset; export type Object_Product = Element & { __typename?: 'object_product'; _siblings?: Maybe>>; + alternative?: Maybe; alwaysDisplay?: Maybe; bundlePath?: Maybe; children?: Maybe>>; @@ -557,11 +647,13 @@ export type Object_Product = Element & { itemDescription?: Maybe; itemId?: Maybe; modificationDate?: Maybe; + objectType?: Maybe; options?: Maybe>>; p21Uid?: Maybe; parent?: Maybe; productPictures?: Maybe>>; properties?: Maybe>>; + secondaryBundlePath?: Maybe; shortDescription?: Maybe; shouldHideBasedOnWidth?: Maybe; spCategories?: Maybe>>; @@ -597,19 +689,25 @@ export type Object_ProductTagsArgs = { name?: InputMaybe; }; +/** pseudo class for field alternative */ +export type Object_Product_Alternative = Object_Alternative; + /** pseudo class for field bundlePath */ export type Object_Product_BundlePath = Asset; export type Object_Product_Finishes = { __typename?: 'object_product_finishes'; element?: Maybe; - metadata?: Maybe>>; + metadata?: Maybe>>; }; export type Object_Product_Options = Object_Product; export type Object_Product_ProductPictures = Asset; +/** pseudo class for field secondaryBundlePath */ +export type Object_Product_SecondaryBundlePath = Asset; + export type Object_Product_SpCategories = Object_SpCategory; /** pseudo class for field spCollection */ @@ -632,6 +730,7 @@ export type Object_SpCategory = Element & { key?: Maybe; modificationDate?: Maybe; name?: Maybe; + objectType?: Maybe; parent?: Maybe; properties?: Maybe>>; slug?: Maybe; @@ -674,6 +773,7 @@ export type Object_SpCollection = Element & { key?: Maybe; modificationDate?: Maybe; name?: Maybe; + objectType?: Maybe; parent?: Maybe; properties?: Maybe>>; slug?: Maybe; @@ -719,6 +819,7 @@ export type Object_SpDrawerTypes = Element & { key?: Maybe; modificationDate?: Maybe; name?: Maybe; + objectType?: Maybe; parent?: Maybe; properties?: Maybe>>; slug?: Maybe; @@ -763,6 +864,7 @@ export type Object_SpFinish = Element & { key?: Maybe; modificationDate?: Maybe; name?: Maybe; + objectType?: Maybe; parent?: Maybe; properties?: Maybe>>; slug?: Maybe; @@ -792,7 +894,7 @@ export type Object_SpFinishTagsArgs = { /** pseudo class for field image */ export type Object_SpFinish_Image = Asset; -export type Object_Tree = Object_Product | Object_SpCategory | Object_SpCollection | Object_SpDrawerTypes | Object_SpFinish; +export type Object_Tree = Object_Alternative | Object_Product | Object_SpCategory | Object_SpCollection | Object_SpDrawerTypes | Object_SpFinish; export type Property_Checkbox = { __typename?: 'property_checkbox'; @@ -808,6 +910,13 @@ export type Property_Object = { type?: Maybe; }; +export type Property_Select = { + __typename?: 'property_select'; + name?: Maybe; + text?: Maybe; + type?: Maybe; +}; + export type Property_Text = { __typename?: 'property_text'; name?: Maybe; @@ -845,7 +954,7 @@ export type SpFinishFragment = { __typename?: 'object_spFinish', id?: string | n export type ConfiguratorAttributesFragment = { __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null }; -export type ProductFragment = { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_621f7745f2ed6', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null }; +export type ProductFragment = { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_6262fc65db489', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null }; export type GetSpCategoryListingQueryVariables = Exact<{ [key: string]: never; }>; @@ -894,7 +1003,7 @@ export type GetProductListingQueryVariables = Exact<{ }>; -export type GetProductListingQuery = { __typename?: 'Query', getProductListing?: { __typename?: 'ProductConnection', edges?: Array<{ __typename?: 'ProductEdge', node?: { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_621f7745f2ed6', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null } | null } | null> | null } | null }; +export type GetProductListingQuery = { __typename?: 'Query', getProductListing?: { __typename?: 'ProductConnection', edges?: Array<{ __typename?: 'ProductEdge', node?: { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_6262fc65db489', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null } | null } | null> | null } | null }; export type GetProductStatusQueryVariables = Exact<{ [key: string]: never; }>; diff --git a/src/generated/nexus.d.ts b/src/generated/nexus.d.ts index bd5df69..ad9d80b 100644 --- a/src/generated/nexus.d.ts +++ b/src/generated/nexus.d.ts @@ -4880,18 +4880,38 @@ export interface NexusGenObjects { id: number; // Int! moduleId: number; // Int! }; + ModuleCategoryMetadata: { + // root type + externalId: string; // String! + slug?: string | null; // String + }; + ModuleCollectionsMetadata: { + // root type + externalId: string; // String! + slug?: string | null; // String + }; ModuleDimension: { // root type depth?: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax height?: NexusGenRootTypes['ModuleUnit'] | null; // ModuleUnit width?: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax }; + ModuleDrawerTypesMetadata: { + // root type + externalId: string; // String! + slug?: string | null; // String + }; ModuleExtensionsMetadata: { // root type left?: string | null; // String - options?: string[] | null; // [String!] + options?: Array | null; // [String] right?: string | null; // String }; + ModuleFinishesMetadata: { + // root type + externalId: string; // String! + slug?: string | null; // String + }; ModuleMinMax: { // root type max?: NexusGenRootTypes['ModuleUnit'] | null; // ModuleUnit @@ -4899,26 +4919,39 @@ export interface NexusGenObjects { }; ModuleRules: { // root type + alwaysDisplay?: boolean | null; // Boolean bundleUrl?: string | null; // String - dimensions?: NexusGenRootTypes['ModuleDimension'] | null; // ModuleDimension + categories?: Array | null; // [ModuleCategoryMetadata] + collection: NexusGenRootTypes['ModuleCollectionsMetadata']; // ModuleCollectionsMetadata! + description?: string | null; // String + dimensions: NexusGenRootTypes['ModuleDimension']; // ModuleDimension! + drawerTypes?: Array | null; // [ModuleDrawerTypesMetadata] extensions?: NexusGenRootTypes['ModuleExtensionsMetadata'] | null; // ModuleExtensionsMetadata - finishes?: string[] | null; // [String!] + externalId: string; // String! + finish: NexusGenRootTypes['ModuleFinishesMetadata']; // ModuleFinishesMetadata! + hasPegs?: boolean | null; // Boolean + isEdge?: boolean | null; // Boolean isImprintExtension: boolean; // Boolean! + isMat?: boolean | null; // Boolean + isSubmodule?: boolean | null; // Boolean + otherFinishes?: string[] | null; // [String!] partNumber: string; // String! rules?: NexusGenRootTypes['ModuleRulesMetadata'] | null; // ModuleRulesMetadata - trims?: string[] | null; // [String!] + shouldHideBasedOnWidth?: boolean | null; // Boolean + thumbnailUrl?: string | null; // String + trims?: Array | null; // [String] }; ModuleRulesMetadata: { // root type angle?: number | null; // Float fullDepth?: boolean | null; // Boolean isFiller?: boolean | null; // Boolean - options?: string[] | null; // [String!] + options?: Array | null; // [String] queue?: NexusGenRootTypes['QueueInfoMetadata'] | null; // QueueInfoMetadata requiredNetInterior?: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax rotation?: number | null; // Float trimOffset?: NexusGenRootTypes['TrimOffsetMetadata'] | null; // TrimOffsetMetadata - trimmable?: string[] | null; // [String!] + trimmable?: Array | null; // [String] }; ModuleType: { // root type @@ -5172,18 +5205,38 @@ export interface NexusGenFieldTypes { module: NexusGenRootTypes['Module']; // Module! moduleId: number; // Int! }; + ModuleCategoryMetadata: { + // field return type + externalId: string; // String! + slug: string | null; // String + }; + ModuleCollectionsMetadata: { + // field return type + externalId: string; // String! + slug: string | null; // String + }; ModuleDimension: { // field return type depth: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax height: NexusGenRootTypes['ModuleUnit'] | null; // ModuleUnit width: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax }; + ModuleDrawerTypesMetadata: { + // field return type + externalId: string; // String! + slug: string | null; // String + }; ModuleExtensionsMetadata: { // field return type left: string | null; // String - options: string[] | null; // [String!] + options: Array | null; // [String] right: string | null; // String }; + ModuleFinishesMetadata: { + // field return type + externalId: string; // String! + slug: string | null; // String + }; ModuleMinMax: { // field return type max: NexusGenRootTypes['ModuleUnit'] | null; // ModuleUnit @@ -5191,26 +5244,39 @@ export interface NexusGenFieldTypes { }; ModuleRules: { // field return type + alwaysDisplay: boolean | null; // Boolean bundleUrl: string | null; // String - dimensions: NexusGenRootTypes['ModuleDimension'] | null; // ModuleDimension + categories: Array | null; // [ModuleCategoryMetadata] + collection: NexusGenRootTypes['ModuleCollectionsMetadata']; // ModuleCollectionsMetadata! + description: string | null; // String + dimensions: NexusGenRootTypes['ModuleDimension']; // ModuleDimension! + drawerTypes: Array | null; // [ModuleDrawerTypesMetadata] extensions: NexusGenRootTypes['ModuleExtensionsMetadata'] | null; // ModuleExtensionsMetadata - finishes: string[] | null; // [String!] + externalId: string; // String! + finish: NexusGenRootTypes['ModuleFinishesMetadata']; // ModuleFinishesMetadata! + hasPegs: boolean | null; // Boolean + isEdge: boolean | null; // Boolean isImprintExtension: boolean; // Boolean! + isMat: boolean | null; // Boolean + isSubmodule: boolean | null; // Boolean + otherFinishes: string[] | null; // [String!] partNumber: string; // String! rules: NexusGenRootTypes['ModuleRulesMetadata'] | null; // ModuleRulesMetadata - trims: string[] | null; // [String!] + shouldHideBasedOnWidth: boolean | null; // Boolean + thumbnailUrl: string | null; // String + trims: Array | null; // [String] }; ModuleRulesMetadata: { // field return type angle: number | null; // Float fullDepth: boolean | null; // Boolean isFiller: boolean | null; // Boolean - options: string[] | null; // [String!] + options: Array | null; // [String] queue: NexusGenRootTypes['QueueInfoMetadata'] | null; // QueueInfoMetadata requiredNetInterior: NexusGenRootTypes['ModuleMinMax'] | null; // ModuleMinMax rotation: number | null; // Float trimOffset: NexusGenRootTypes['TrimOffsetMetadata'] | null; // TrimOffsetMetadata - trimmable: string[] | null; // [String!] + trimmable: Array | null; // [String] }; ModuleType: { // field return type @@ -5529,18 +5595,38 @@ export interface NexusGenFieldTypeNames { module: 'Module'; moduleId: 'Int'; }; + ModuleCategoryMetadata: { + // field return type name + externalId: 'String'; + slug: 'String'; + }; + ModuleCollectionsMetadata: { + // field return type name + externalId: 'String'; + slug: 'String'; + }; ModuleDimension: { // field return type name depth: 'ModuleMinMax'; height: 'ModuleUnit'; width: 'ModuleMinMax'; }; + ModuleDrawerTypesMetadata: { + // field return type name + externalId: 'String'; + slug: 'String'; + }; ModuleExtensionsMetadata: { // field return type name left: 'String'; options: 'String'; right: 'String'; }; + ModuleFinishesMetadata: { + // field return type name + externalId: 'String'; + slug: 'String'; + }; ModuleMinMax: { // field return type name max: 'ModuleUnit'; @@ -5548,13 +5634,26 @@ export interface NexusGenFieldTypeNames { }; ModuleRules: { // field return type name + alwaysDisplay: 'Boolean'; bundleUrl: 'String'; + categories: 'ModuleCategoryMetadata'; + collection: 'ModuleCollectionsMetadata'; + description: 'String'; dimensions: 'ModuleDimension'; + drawerTypes: 'ModuleDrawerTypesMetadata'; extensions: 'ModuleExtensionsMetadata'; - finishes: 'String'; + externalId: 'String'; + finish: 'ModuleFinishesMetadata'; + hasPegs: 'Boolean'; + isEdge: 'Boolean'; isImprintExtension: 'Boolean'; + isMat: 'Boolean'; + isSubmodule: 'Boolean'; + otherFinishes: 'String'; partNumber: 'String'; rules: 'ModuleRulesMetadata'; + shouldHideBasedOnWidth: 'Boolean'; + thumbnailUrl: 'String'; trims: 'String'; }; ModuleRulesMetadata: { diff --git a/src/generated/schema.graphql b/src/generated/schema.graphql index 0b9e6bb..5cbf8a7 100644 --- a/src/generated/schema.graphql +++ b/src/generated/schema.graphql @@ -1394,6 +1394,11 @@ input ModuleCategoryListRelationFilter { some: ModuleCategoryWhereInput } +type ModuleCategoryMetadata { + externalId: String! + slug: String +} + input ModuleCategoryOrderByInput { categoryId: SortOrder id: SortOrder @@ -1462,6 +1467,11 @@ input ModuleCategoryWhereUniqueInput { id: Int } +type ModuleCollectionsMetadata { + externalId: String! + slug: String +} + input ModuleCreateManyAttachmentToAppendInput { alwaysDisplay: Boolean bundleUrl: String @@ -2105,12 +2115,22 @@ type ModuleDimension { width: ModuleMinMax } +type ModuleDrawerTypesMetadata { + externalId: String! + slug: String +} + type ModuleExtensionsMetadata { left: String - options: [String!] + options: [String] right: String } +type ModuleFinishesMetadata { + externalId: String! + slug: String +} + input ModuleListRelationFilter { every: ModuleWhereInput none: ModuleWhereInput @@ -2147,30 +2167,47 @@ input ModuleOrderByInput { } type ModuleRules { + alwaysDisplay: Boolean bundleUrl: String - dimensions: ModuleDimension + categories: [ModuleCategoryMetadata] + collection: ModuleCollectionsMetadata! + description: String + dimensions: ModuleDimension! + drawerTypes: [ModuleDrawerTypesMetadata] """ Extensions are sub pieces that MUST BE CONNECTED to the main product or other extension. """ extensions: ModuleExtensionsMetadata + externalId: String! """ - Modules that are basically this module but in a different finish(color), to allow the ui to easily switch between them + The current finish of this module """ - finishes: [String!] + finish: ModuleFinishesMetadata! + hasPegs: Boolean + isEdge: Boolean isImprintExtension: Boolean! + isMat: Boolean + isSubmodule: Boolean + + """ + The equivalent of same module but on other finishes + """ + otherFinishes: [String!] """ The module part number, probably equivalent to the module id """ partNumber: String! rules: ModuleRulesMetadata + shouldHideBasedOnWidth: Boolean + thumbnailUrl: String """ Different types of edges a module might have """ - trims: [String!] + trims: [String] } type ModuleRulesMetadata { @@ -2192,7 +2229,7 @@ type ModuleRulesMetadata { """ Options are which other modules can be put IN modules """ - options: [String!] + options: [String] """ Queue info @@ -2213,7 +2250,7 @@ type ModuleRulesMetadata { """ Where a module can be cut if there's excess beyond the drawer """ - trimmable: [String!] + trimmable: [String] } input ModuleScalarWhereInput { diff --git a/src/schema/moduleRules.ts b/src/schema/moduleRules.ts index 758b1fd..02b6266 100644 --- a/src/schema/moduleRules.ts +++ b/src/schema/moduleRules.ts @@ -78,11 +78,11 @@ export const ModuleRulesMetadata = objectType({ description: 'The amount (in degrees) that the product can be angled' }); - t.list.nonNull.string('options', { + t.list.string('options', { description: 'Options are which other modules can be put IN modules' }); - t.list.nonNull.string('trimmable', { + t.list.string('trimmable', { description: "Where a module can be cut if there's excess beyond the drawer" }); @@ -105,12 +105,44 @@ export const ModuleRulesMetadata = objectType({ } }); +export const ModuleCollectionsMetadata = objectType({ + name: 'ModuleCollectionsMetadata', + definition(t) { + t.string('slug'); + t.nonNull.string('externalId'); + } +}); + export const ModuleExtensionsMetadata = objectType({ name: 'ModuleExtensionsMetadata', definition(t) { t.string('left'); t.string('right'); - t.list.nonNull.string('options'); + t.list.string('options'); + } +}); + +export const ModuleFinishesMetadata = objectType({ + name: 'ModuleFinishesMetadata', + definition(t) { + t.string('slug'); + t.nonNull.string('externalId'); + } +}); + +export const ModuleDrawerTypesMetadata = objectType({ + name: 'ModuleDrawerTypesMetadata', + definition(t) { + t.string('slug'); + t.nonNull.string('externalId'); + } +}); + +export const ModuleCategoryMetadata = objectType({ + name: 'ModuleCategoryMetadata', + definition(t) { + t.string('slug'); + t.nonNull.string('externalId'); } }); @@ -121,20 +153,45 @@ export const ModuleRules = objectType({ description: 'The module part number, probably equivalent to the module id' }); - t.list.nonNull.string('finishes', { - description: - 'Modules that are basically this module but in a different finish(color), to allow the ui to easily switch between them' - }); + t.nonNull.string('externalId'); + t.string('description'); + t.string('thumbnailUrl'); + t.string('bundleUrl'); + t.boolean('isSubmodule'); + t.boolean('hasPegs'); + t.boolean('isMat'); + t.boolean('shouldHideBasedOnWidth'); + t.boolean('alwaysDisplay'); + t.boolean('isEdge'); + + t.nonNull.boolean('isImprintExtension'); - t.list.nonNull.string('trims', { + t.list.string('trims', { description: 'Different types of edges a module might have' }); - t.string('bundleUrl'); + t.list.nonNull.string('otherFinishes', { + description: 'The equivalent of same module but on other finishes' + }); - t.nonNull.boolean('isImprintExtension'); + t.nonNull.field('finish', { + type: ModuleFinishesMetadata, + description: 'The current finish of this module' + }); + + t.nonNull.field('collection', { + type: ModuleCollectionsMetadata + }); + + t.list.field('drawerTypes', { + type: ModuleDrawerTypesMetadata + }); + + t.list.field('categories', { + type: ModuleCategoryMetadata + }); - t.field('dimensions', { + t.nonNull.field('dimensions', { type: ModuleDimension }); diff --git a/src/services/marathon/fragments.ts b/src/services/marathon/fragments.ts index f437c30..f076e80 100644 --- a/src/services/marathon/fragments.ts +++ b/src/services/marathon/fragments.ts @@ -247,6 +247,16 @@ export const SP_PRODUCT_FRAGMENT = gql` partNumber: itemId childrenSortBy classname + alternative { + ... on object_alternative { + id + partNumber: key + hasPegs + bundlePath { + ...Asset + } + } + } creationDate hasPegs index diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index cc17b1f..e0c82e6 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -1,6 +1,5 @@ import { ApolloClient, from, HttpLink, InMemoryCache, NormalizedCacheObject } from '@apollo/client/core'; -import { Locale, PrismaClient } from '@prisma/client'; -import { rules } from '@typescript-eslint/eslint-plugin'; +import { Locale, Module, PrismaClient } from '@prisma/client'; import { ForbiddenError } from 'apollo-server'; import axios, { AxiosResponse } from 'axios'; import fetch from 'cross-fetch'; @@ -17,12 +16,12 @@ import { } from '../../generated/graphql'; import { NexusGenObjects } from '../../generated/nexus'; import { makeError } from '../../utils/exception'; -import { makeFile, replaceExtension } from '../../utils/file'; +import { makeFile } from '../../utils/file'; import logging from '../../utils/logging'; import { fileUploadService } from '../fileUpload'; import { projectService } from '../project'; -import { MarathonModule } from './parsing/constants'; -import { makeQueueAppendRulesFromMarathonModule, mergeRules } from './parsing/parseRules'; +import { MarathonModule, ModuleRules } from './parsing/constants'; +import { makeRulesFromMarathonModule, makeThumbnailUrlAndQueue, mergeRules } from './parsing/parseRules'; import { GET_PRODUCT_LISTING, GET_SP_CATEGORY_LISTING, @@ -79,26 +78,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { destinationPath: string; }[] = []; - const makeThumbnailUrlAndQueue = (sourcePath?: string | null, currentPath?: string | null) => { - let thumbnailUrl: string | undefined; - - if (sourcePath?.trim() && currentPath?.trim()) { - thumbnailUrl = replaceExtension(currentPath, sourcePath); - let originalPath = thumbnailUrl; - - // If the extension were changed, the paths are now different. So store the previous original path so the image can be deleted - if (currentPath !== originalPath) originalPath = currentPath; - - storageSyncQueue.push({ - sourcePath, - originalPath, - destinationPath: thumbnailUrl - }); - } - - return thumbnailUrl; - }; - const storageSync = async () => { if (!MARATHON_MEDIA_URI) { throw new Error('Missing marathon environment'); @@ -692,42 +671,213 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('finish'); }; - const makeProductFromModule = ( - module: MarathonModule, - targetThumbnailUrl?: string | null, - currentRules?: NexusGenObjects['ModuleRules'] | null - ) => { - const rules = mergeRules(module, currentRules); - const sourceThumbnail = - module?.productPictures && module.productPictures.length > 0 - ? module?.productPictures[0]?.fullpath?.trim() - : undefined; - - return { - partNumber: module?.partNumber?.trim() as string, - externalId: module?.id?.trim(), - description: module?.titleDescription?.trim() || undefined, - thumbnailUrl: makeThumbnailUrlAndQueue( - sourceThumbnail, - targetThumbnailUrl || `images/module/${module?.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` - ), - // bundleUrl: module?.bundlePath?.fullpath?.trim() || undefined, // FIX: Uncomment after also importing/uploading the image - isSubmodule: module?.isSubmodule || false, - hasPegs: module?.hasPegs || false, - isMat: module?.isMat || false, - // isExtension: module.isExtension || false,, TODO: Make sure they provide this info - shouldHideBasedOnWidth: - module?.shouldHideBasedOnWidth !== undefined && module?.shouldHideBasedOnWidth !== null - ? module?.shouldHideBasedOnWidth - : true, - alwaysDisplay: module?.alwaysDisplay || false, - isEdge: module?.isEdge || false, - rules - // TODO: Default left extension - // TODO: Default right extension - // TODO: attachmentToAppend: newRules?.rules. - // TODO: module attachments - }; + const upsertProductModule = async ( + module: ModuleRules, + skipDatabase?: boolean + ): Promise<'created' | 'updated' | 'failed'> => { + if (!db) { + throw new Error('db dependency was not provided'); + } + + if (!module.externalId) return 'failed'; + + let status: 'created' | 'updated' | 'failed' = 'created'; + + console.log(`Upserting module ${module.partNumber} ${module.externalId}`); + + const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); + + const existingProduct = await db.module.findUnique({ + where: { + externalId: module.externalId + } + }); + + const { finish, collection, drawerTypes, categories, otherFinishes, ...moduleRest } = module; + + let resultModule: Module | undefined; + + //! Use interactive transactions with caution. Keeping transactions open for a long time hurts database performance and can even cause deadlocks. + //! Try to avoid performing network requests and executing slow queries inside, get in and out as quick as possible! + await db.$transaction(async (db) => { + if (!existingProduct) { + if (!skipDatabase) { + resultModule = await db.module.create({ + data: { + ...moduleRest, + rules: module, + finish: { + connect: { + externalId: finish.externalId + } + }, + collection: { + connect: { + externalId: collection.externalId + } + }, + defaultLeftExtension: module.extensions?.left + ? { + connect: { + partNumber: module.extensions.left + } + } + : undefined, + defaultRightExtension: module.extensions?.right + ? { + connect: { + partNumber: module.extensions.right + } + } + : undefined, + attachmentToAppend: module.rules?.queue?.append + ? { + connect: { + partNumber: module.rules.queue.append + } + } + : undefined + } + }); + } + } else { + status = 'updated'; + if (!skipDatabase) { + const rules = existingProduct.rules ? mergeRules(module, existingProduct.rules as ModuleRules) : module; + + await db.module.update({ + where: { id: existingProduct.id }, + data: { + ...moduleRest, + rules, + finish: { + connect: { + externalId: finish.externalId + } + }, + collection: { + connect: { + externalId: collection.externalId + } + }, + defaultLeftExtension: module.extensions?.left + ? { + connect: { + partNumber: module.extensions.left + } + } + : undefined, + defaultRightExtension: module.extensions?.right + ? { + connect: { + partNumber: module.extensions.right + } + } + : undefined, + attachmentToAppend: module.rules?.queue?.append + ? { + connect: { + partNumber: module.rules.queue.append + } + } + : undefined + } + }); + + // If this module already exists, it already has all the relations, so delete them for them to be created + // This is needed in case they completely changed the values here + await db.moduleType.deleteMany({ where: { module: { id: existingProduct.id } } }); + await db.moduleCategory.deleteMany({ where: { module: { id: existingProduct.id } } }); + await db.moduleAttachments.deleteMany({ where: { module: { id: existingProduct.id } } }); + } + } + + if (resultModule) { + if (!skipDatabase && drawerTypes && drawerTypes.length > 0) { + const existingTypes = await db.type.findMany({ + where: { + externalId: { + // Casting since we're filtering right before + in: drawerTypes.filter((x) => !!x).map((x) => x?.externalId as string) + } + }, + select: { + id: true, + externalId: true + } + }); + + await db.moduleType.createMany({ + data: drawerTypes.map((type) => ({ + moduleId: resultModule?.id || -1, + typeId: existingTypes.find((x) => x.externalId === type?.externalId)?.id || -1 + })) + }); + } + + if (!skipDatabase && categories && categories.length > 0) { + const existingCategories = await db.category.findMany({ + where: { + OR: [ + { + externalId: { + // Casting since we're filtering right before + in: categories.filter((x) => !!x).map((x) => x?.externalId as string) + } + }, + { + slug: 'all' + } + ] + }, + select: { + id: true, + externalId: true, + slug: true + } + }); + + await db.moduleCategory.createMany({ + // Manually add the all category + data: [...categories, { slug: 'all', externalId: undefined }].map((category) => ({ + moduleId: resultModule?.id || -1, + categoryId: + existingCategories.find( + // Whether it's the correct category or all category + (x) => x.externalId === category?.externalId || (category?.slug === 'all' && x.slug === 'all') + )?.id || -1 + })) + }); + } + + const moduleAttachments = module.rules?.queue?.modules; + + if (!skipDatabase && moduleAttachments && moduleAttachments.length > 0) { + const existingModules = await db.module.findMany({ + where: { + partNumber: { in: moduleAttachments.map((x) => x) } + }, + select: { + id: true, + partNumber: true + } + }); + + await db.moduleAttachments.createMany({ + // Manually add the all category + data: moduleAttachments.map((modAttachment) => ({ + moduleId: resultModule?.id || -1, + attachmentId: existingModules.find((x) => x.partNumber === modAttachment)?.id || -1 + })) + }); + } + } + }); + + // TODO: sync thumbnail image + + return status; }; const syncProduct = async (skipDatabase?: boolean) => { @@ -743,21 +893,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { try { console.log('Fetching required data'); - const existingCategories = await db.category.findMany({ - select: { - id: true, - externalId: true, - slug: true - } - }); - - const existingTypes = await db.type.findMany({ - select: { - id: true, - externalId: true - } - }); - const existingFinishes = await db.finish.findMany({ select: { id: true, @@ -787,78 +922,57 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }); - const products = data.getProductListing?.edges || []; + let products = data.getProductListing?.edges || []; if (products && products.length > 0) { console.log(`Product page ${pageIndex + 1}, fetched ${products.length} products`); - products.forEach((product, i) => { - const module = product?.node; - const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - - makeFile(dir, path.join(`marathon/${module?.partNumber || i}.json`), module || {}); + // Small debug method to output every product + // products.forEach((product, i) => { + // const module = product?.node; + // const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - const rules = mergeRules(module); - makeFile(dir, path.join(`jsons/${module?.partNumber || i}.json`), rules || {}); + // makeFile(dir, path.join(`marathon/${module?.partNumber || i}.json`), module || {}); - const queueAppend = makeQueueAppendRulesFromMarathonModule(module); - - if (queueAppend?.append) - makeFile( - dir, - path.join(`jsons/${queueAppend.append.partNumber || `append-${i}`}.json`), - queueAppend.append - ); - - if (queueAppend?.queueModules && queueAppend.queueModules.length > 0) - queueAppend.queueModules.forEach((queueModule, j) => - makeFile(dir, path.join(`jsons/${queueModule.partNumber || `queuemodule-${j}`}.json`), queueModule) - ); - }); + // const rules = mergeRules(module); + // makeFile(dir, path.join(`jsons/${module?.partNumber || i}.json`), rules || {}); - const ids = products - // Casting because we're explicitly filtering by only valid values - .map((productEdge) => productEdge?.node?.id as string) - .filter((x) => !!x); + // const queueAppend = makeQueueAppendRulesFromMarathonModule(module); - const existingModules = await db.module.findMany({ - select: { - id: true, - externalId: true, - rules: true, - thumbnailUrl: true - }, - where: { - externalId: { - in: ids - } - } - }); + // if (queueAppend?.append) + // makeFile( + // dir, + // path.join(`jsons/${queueAppend.append.partNumber || `append-${i}`}.json`), + // queueAppend.append + // ); - // Received products - const modulesToUpdate = products.filter( - (productEdge) => - // Where exists in the database - productEdge?.node?.id && existingModules.some((mod) => mod.externalId === productEdge?.node?.id) - ); + // if (queueAppend?.queueModules && queueAppend.queueModules.length > 0) + // queueAppend.queueModules.forEach((queueModule, j) => + // makeFile(dir, path.join(`jsons/${queueModule.partNumber || `queuemodule-${j}`}.json`), queueModule) + // ); + // }); - // Received products - const modulesToCreate = products.filter( + products = products.filter( // Where it DOESN'T exist in the database (productEdge) => { + // Make a big filter because their api decides to return unrelated stuff, so we need to hard filter everything + const module = productEdge?.node; + // So we grab a finish Id if any(there should always be one) const finishId = existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || undefined; + + // So we grab a collection Id if any(there should always be one) const collectionId = existingCollections.find((collection) => collection.externalId === module?.spCollection?.id)?.id || undefined; + // And filter const hasExpectedCondition = - finishId !== undefined && - collectionId !== undefined && - module?.id && - !existingModules.some((mod) => mod.externalId === module.id); + finishId !== undefined && // Is there finish id(should have) + collectionId !== undefined && // Is there collection id(should have) + module?.id; // Does it have an id itself (all of them should have id) if (!hasExpectedCondition) { // Casting because we know it should exist, since there's a condition for that in hasExpectedCondition @@ -869,198 +983,89 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } ); - if (!skipDatabase) { - if (modulesToCreate && modulesToCreate.length > 0) { - console.log(`Batch creating ${modulesToCreate.length} products`); - try { - await db.$transaction(async (db) => { - await db.module.createMany({ - data: modulesToCreate.map((productEdge) => { - const module = productEdge?.node; - const product = makeProductFromModule(module); - return { - ...product, - finishId: - existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || -1, - collectionId: - existingCollections.find((collection) => collection.externalId === module?.spCollection?.id) - ?.id || -1 - }; - }) - }); - - console.log(`Fetching recently created ${modulesToCreate.length} products`); - const recentlyCreatedModules = await db.module.findMany({ - where: { - externalId: { - in: modulesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) - } - }, - select: { - id: true, - externalId: true - } - }); - - console.log(`Batch creating ${recentlyCreatedModules.length} product categories`); - - const categoriesToCreate = modulesToCreate.flatMap((productEdge) => - productEdge?.node?.spCategories?.map((cat) => ({ - catExternalId: cat?.id, - catSlug: null, - moduleExternalId: productEdge?.node?.id - })) - ); - - const categoryAllToCreate = modulesToCreate.map((productEdge) => ({ - catSlug: 'all', - catExternalId: null, - moduleExternalId: productEdge?.node?.id - })); - - await db.moduleCategory.createMany({ - data: [...categoriesToCreate, ...categoryAllToCreate] - .filter((x) => !!x) - .map((catModule) => { - return { - moduleId: - recentlyCreatedModules.find((x) => x.externalId === catModule?.moduleExternalId)?.id || -1, - categoryId: - existingCategories.find((x) => - catModule?.catExternalId - ? x.externalId === catModule?.catExternalId - : x.slug === catModule?.catSlug - )?.id || -1 - }; - }) - }); - - console.log(`Batch creating ${recentlyCreatedModules.length} product types`); - await db.moduleType.createMany({ - data: modulesToCreate - .flatMap((productEdge) => - productEdge?.node?.spDrawerTypes?.map((type) => ({ - typeExternalId: type?.id, - moduleExternalId: productEdge?.node?.id - })) - ) - .filter((x) => !!x) - .map((typeModule) => ({ - moduleId: - recentlyCreatedModules.find((x) => x.externalId === typeModule?.moduleExternalId)?.id || -1, - typeId: existingTypes.find((x) => x.externalId === typeModule?.typeExternalId)?.id || -1 - })) - }); - }); - } catch (err) { - logging.error(err, 'Error when batch creating products', { - modulesToCreate: modulesToCreate?.map((x) => x?.node).filter((x) => !!x), - existingCollections, - existingFinishes - }); + const parsedProducts = products + .filter((x) => !!x?.node) + .flatMap((productEdge) => makeRulesFromMarathonModule(productEdge?.node as MarathonModule)); // Casting since we filtered it previously + + let created = 0; + let updated = 0; + + for (let i = 0; i < parsedProducts.length; i++) { + const product = parsedProducts[i]; + + if (product.attachments?.append) { + const appendStatus = await upsertProductModule(product.attachments.append, skipDatabase); + switch (appendStatus) { + case 'created': + created++; + case 'updated': + updated++; + case 'failed': + throw makeError('Could not upsert attachment append', 'cannotUpsertAppend'); } - } else { - console.log(`No module to create`); } - for (let i = 0; i < modulesToUpdate.length; i++) { - const productEdge = modulesToUpdate[i]; - - const moduleEdge = productEdge?.node; - if (!moduleEdge?.id) continue; - - const existingModule = existingModules.find((x) => x.externalId === moduleEdge.id); - if (!existingModule) continue; - - console.log(`Updating module #${i + 1} id: ${moduleEdge.id} of ${modulesToUpdate.length}`); - - await db.$transaction(async (db) => { - // Sync categories - - // Delete existing categories to re create - await db.moduleCategory.deleteMany({ - where: { module: { externalId: moduleEdge.id }, category: { slug: { not: 'all' } } } - }); - - // If there are categories for this module - if (moduleEdge.spCategories && moduleEdge.spCategories.length > 0) { - // Create them - await db.moduleCategory.createMany({ - data: moduleEdge.spCategories.map((cat) => ({ - moduleId: existingModule?.id || -1, - categoryId: existingCategories.find((x) => x.slug === cat?.slug?.trim())?.id || -1 - })) - }); + if (product.attachments?.queueModules && product.attachments.queueModules.length > 0) { + for (let j = 0; j < product.attachments.queueModules.length; j++) { + const queueModule = product.attachments.queueModules[j]; + const queueStatus = await upsertProductModule(queueModule, skipDatabase); + switch (queueStatus) { + case 'created': + created++; + case 'updated': + updated++; + case 'failed': + throw makeError('Could not upsert attachment queue moduke', 'cannotUpsertQueueModule'); } + } + } - // Sync type + if (product.extensions?.left) { + const extensionStatus = await upsertProductModule(product.extensions.left, skipDatabase); + switch (extensionStatus) { + case 'created': + created++; + case 'updated': + updated++; + case 'failed': + throw makeError('Could not upsert left extension', 'cannotUpsertLeftExtension'); + } + } - // Delete existing types to then create - await db.moduleType.deleteMany({ where: { module: { externalId: moduleEdge.id } } }); + if (product.extensions?.right) { + const extensionStatus = await upsertProductModule(product.extensions.right, skipDatabase); + switch (extensionStatus) { + case 'created': + created++; + case 'updated': + updated++; + case 'failed': + throw makeError('Could not upsert right extension', 'cannotUpsertRightExtension'); + } + } - // If there are types for this module - if (moduleEdge.spDrawerTypes && moduleEdge.spDrawerTypes.length > 0) { - // Create them - await db.moduleType.createMany({ - data: moduleEdge.spDrawerTypes.map((type) => ({ - moduleId: existingModule?.id || -1, - typeId: existingTypes.find((x) => x.externalId === type?.id)?.id || -1 - })) - }); - } + if (product.alternative) { + const extensionStatus = await upsertProductModule(product.alternative, skipDatabase); + switch (extensionStatus) { + case 'created': + created++; + case 'updated': + updated++; + case 'failed': + throw makeError('Could not upsert alternative version', 'cannotUpsertAlternative'); + } + } - // TODO: module attachments - - const product = makeProductFromModule( - moduleEdge, - existingModule?.thumbnailUrl, - // Casting since it's a json type and it doesn't know, but we know - existingModule?.rules as NexusGenObjects['ModuleRules'] | undefined - ); - - await db.module.update({ - // Casting because we're sure it exists due to previous check - where: { externalId: moduleEdge.id as string }, - data: { - ...product, - finish: moduleEdge.spFinish?.slug?.trim() - ? { - connect: { - slug: moduleEdge.spFinish.slug.trim() - } - } - : undefined, - collection: moduleEdge.spCollection?.slug?.trim() - ? { - connect: { - slug: moduleEdge.spCollection.slug.trim() - } - } - : undefined, - // TODO: Default left extension - defaultLeftExtension: product.rules?.extensions?.left - ? { - connect: { - partNumber: product.rules.extensions.left - } - } - : undefined, - // TODO: Default right extension - defaultRightExtension: product.rules?.extensions?.right - ? { - connect: { - partNumber: product.rules.extensions.right - } - } - : undefined - // TODO: attachmentToAppend: newRules?.rules. - } - }); - }); + const productStatus = await upsertProductModule(product.module, skipDatabase); + switch (productStatus) { + case 'created': + created++; + case 'updated': + updated++; } } - if (modulesToCreate && modulesToCreate.length === 0 && modulesToUpdate && modulesToUpdate.length === 0) { + if (created === 0 && updated === 0) { emptyPages++; console.log(`Empty page ${emptyPages} of ${MARATHON_SYNC_EMPTY_PAGES_TO_STOP}`); } else { @@ -1079,7 +1084,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { pageIndex++; } } else { - // If there are no more procuts, it means we should stop + // If there are no more products, it means we should stop console.log(`No products on page ${pageIndex + 1}, last page finished.`); pageIndex = -1; } diff --git a/src/services/marathon/parsing/constants.ts b/src/services/marathon/parsing/constants.ts index 6789d83..9a1e2f2 100644 --- a/src/services/marathon/parsing/constants.ts +++ b/src/services/marathon/parsing/constants.ts @@ -1,4 +1,6 @@ import { GetProductListingQuery } from '../../../generated/graphql'; +import { NexusGenObjects } from '../../../generated/nexus'; +import { NoNullFields } from '../../../utils/types'; export const FEATURE_NAMES = { DIMENSION_HEIGHT: 'height', @@ -16,6 +18,8 @@ export const FEATURE_NAMES = { DIMENSION_ATTRIBUTE: 'Dimensions - Drawer Organizers', QUEUE_MODULES_ATTRIBUTE: 'Queue Modules for SpiceRack', QUEUE_APPEND_ATTRIBUTE: 'Queue Append for SpiceRack', + RIGHT_EXTENSION_ATTRIBUTE: 'Right Extensions for Imprint CT', + LEFT_EXTENSION_ATTRIBUTE: 'Left Extensions for Imprint CT', RULES_ATTRIBUTE: 'Rules for Options', EXT_PART: 'ext_part', EXT_FINISHES: 'ext_finishes', @@ -26,13 +30,19 @@ export const FEATURE_NAMES = { EXT_SIDE_LEFT: 'imprint_ext_side_left', EXT_SIDE_RIGHT: 'imprint_ext_side_right', QUEUE_MODULES: 'queue_modules', - QUEUE_APPEND: 'queue_append' + QUEUE_APPEND: 'queue_append', + PRODUCT_PICTURE_FULL_PATH: 'product_picture_full_path', + HAS_PEGS: 'has_pegs', + IS_MAT: 'is_mat' + // SHOULD_HIDE_BASED_ON_WIDTH: 'should_hide_based_on_width' }; export type MarathonModule = NonNullable< - NonNullable['edges']>[0] ->['node']; + NonNullable['edges']>[0]>['node'] +>; export type ConfiguratorAttribute = NonNullable['configuratorAttributes']>[number]; export type FeatureList = NonNullable['features']; + +export type ModuleRules = NoNullFields; diff --git a/src/services/marathon/parsing/parseRules.ts b/src/services/marathon/parsing/parseRules.ts index 9a0bb79..ef5c054 100644 --- a/src/services/marathon/parsing/parseRules.ts +++ b/src/services/marathon/parsing/parseRules.ts @@ -1,26 +1,26 @@ import deepmerge from 'deepmerge'; import { isEqual } from 'lodash'; +import path from 'path'; import { CsFeatureInput } from '../../../generated/graphql'; import { NexusGenObjects } from '../../../generated/nexus'; import { convertMmToInFormatted } from '../../../utils/conversion'; import { makeError } from '../../../utils/exception'; -import { FeatureList, FEATURE_NAMES, MarathonModule } from './constants'; +import { replaceExtension } from '../../../utils/file'; +import { FeatureList, FEATURE_NAMES, MarathonModule, ModuleRules } from './constants'; import { - getQuantityValueFeature, - numberFromMaybe, getBooleanSelectFeature, getInputFeature, getMultiSelectFeature, getNumericFeature, + getQuantityValueFeature, + numberFromMaybe, numberUndefinedFromMaybe } from './parseValues'; /** * Makes a dimension rule object from a given "configurator attribute" from their api */ -export const makeDimensionRulesFromAttribute = ( - featureList?: FeatureList -): NexusGenObjects['ModuleRules']['dimensions'] => { +export const makeDimensionRulesFromAttribute = (featureList?: FeatureList): ModuleRules['dimensions'] => { // -------- Height const heightMM = getQuantityValueFeature( @@ -97,8 +97,8 @@ export const makeDimensionRulesFromAttribute = ( export const makeRulesObjectFromAttribute = ( featureList?: FeatureList, - getOptions?: () => NonNullable['options'] -): NexusGenObjects['ModuleRules']['rules'] => { + getOptions?: () => NonNullable['options'] +): ModuleRules['rules'] => { // -------- Trimmable const trimmable = getMultiSelectFeature(featureList, FEATURE_NAMES.TRIMMABLE); @@ -182,9 +182,10 @@ export const makeRulesObjectFromAttribute = ( const makeRuleExtensionsFromAttribute = ( featureList?: FeatureList, - getOptions?: () => NonNullable['options'] -): NexusGenObjects['ModuleRules']['extensions'] | undefined => { - // Remove left/right feature that only contain left/right text in it + getOptions?: () => NonNullable['options'] +): ModuleRules['extensions'] | undefined => { + // For some reason, there are TWO attributes with the same name, yay! + // So we remove the useless one, which only have 'left' or 'right' as its text value, instead of what we expect const extensionFeatureList = featureList?.filter( (x) => !( @@ -193,6 +194,7 @@ const makeRuleExtensionsFromAttribute = ( ) ); + // With the incorrect ones removed, we can grab the correct ones const left = getInputFeature(extensionFeatureList, FEATURE_NAMES.EXT_SIDE_LEFT); const right = getInputFeature(extensionFeatureList, FEATURE_NAMES.EXT_SIDE_RIGHT); @@ -205,123 +207,338 @@ const makeRuleExtensionsFromAttribute = ( }; }; -export const makeRulesWithAttributes = ( - featureList: FeatureList, - getPartNumber: () => string | undefined, - isImprintExtension?: boolean, - getFinishes?: () => NexusGenObjects['ModuleRules']['finishes'], - getOptions?: () => NonNullable['options'] -): NexusGenObjects['ModuleRules'] => { - const dimensions = makeDimensionRulesFromAttribute(featureList); - // If this module has extensions, its "options" goes under the extensions - const rules = makeRulesObjectFromAttribute(featureList, getOptions); - const extensions = makeRuleExtensionsFromAttribute(featureList, getOptions); - - return { - partNumber: getPartNumber() || '', - isImprintExtension: !!isImprintExtension, - finishes: getFinishes && getFinishes(), - dimensions, - rules, - extensions - }; -}; - -const makeRulesFromMarathonModule = (marathonModule: MarathonModule): NexusGenObjects['ModuleRules'] => { - const partNumber = marathonModule?.partNumber?.trim(); - if (!partNumber) throw makeError('Cannot create rule without partNumber', 'ruleMergeMissingPartNumber'); +export const makeRulesFromMarathonModule = ( + marathonModule: MarathonModule +): { + module: ModuleRules; + attachments?: ReturnType; + extensions?: ReturnType; + alternative?: ModuleRules; +} => { + const externalId = marathonModule.id; + if (!externalId) throw makeError('Cannot create rule without id', 'ruleMergeMissingId'); + + const marathonFinish = marathonModule.spFinish; + if (!marathonFinish || !marathonFinish.id) + throw makeError('Cannot create rule without finish', 'ruleMergeMissingFinish'); + + const marathonCollection = marathonModule.spCollection; + if (!marathonCollection || !marathonCollection.id) + throw makeError('Cannot create rule without collection', 'ruleMergeMissingCollection'); + + const marathonDrawerTypes = marathonModule.spDrawerTypes; + if (!marathonDrawerTypes || marathonDrawerTypes.length <= 0 || marathonDrawerTypes.some((x) => !x?.id)) + throw makeError('Cannot create rule without finish', 'ruleMergeMissingDrawerType'); const specialAttributes = [ - FEATURE_NAMES.EXT_SIDE_LEFT, - FEATURE_NAMES.EXT_SIDE_RIGHT, + FEATURE_NAMES.LEFT_EXTENSION_ATTRIBUTE, + FEATURE_NAMES.RIGHT_EXTENSION_ATTRIBUTE, FEATURE_NAMES.QUEUE_MODULES_ATTRIBUTE, FEATURE_NAMES.QUEUE_APPEND_ATTRIBUTE ]; - // Merge all attributes that aren't the special attributes into a single one - const catchAllFeatureList = marathonModule?.configuratorAttributes + // Merge all attributes that aren't the special attributes into a single one for ease of use since they decided to make things complicated + // by "Special attributes" I mean whole attributes that contain an entire module in it, and not just rules. Like extensions and attachments + const catchAllFeatureList = marathonModule.configuratorAttributes ?.filter( (attribute) => !specialAttributes.some((specialAttribute) => attribute?.description?.includes(specialAttribute)) ) - .flatMap((x) => x?.features); - - return makeRulesWithAttributes( - catchAllFeatureList as FeatureList, - () => partNumber, - false, - () => - marathonModule?.finishes - ?.map((x) => x?.element?.partNumber) - .filter((x) => !!x) // Remove nulls and undefined values IF they exist - .map((x) => x as string), // Cast to string because we know there are no null/undefined values since we filtered - () => - marathonModule?.options - ?.map((x) => x?.partNumber) - .filter((x) => !!x) // Remove nulls and undefined values IF they exist - .map((x) => x as string) // Cast to string because we know there are no null/undefined values since we filtered - ); + .flatMap((x) => x?.features) as FeatureList; + + const getOptionsFn = () => + marathonModule.options + ?.map((x) => x?.partNumber) + .filter((x) => !!x) // Remove nulls and undefined values IF they exist + .map((x) => x as string); // Cast to string because we know there are no null/undefined values since we filtered + + const dimensions = makeDimensionRulesFromAttribute(catchAllFeatureList); + + // If this module has extensions, its "options" goes under the extensions + const rules = makeRulesObjectFromAttribute(catchAllFeatureList, getOptionsFn); + + // This "extensions" is not the complete extension _object_ but rather the extension property that only references part numbers of those objects + const extensions = makeRuleExtensionsFromAttribute(catchAllFeatureList, getOptionsFn); + + const otherFinishes = marathonModule.finishes + ?.map((x) => x?.element?.partNumber) + .filter((x) => !!x) // Remove nulls and undefined values IF they exist + .map((x) => x as string); // Cast to string because we know there are no null/undefined values since we filtered + + const sourceThumbnail = + marathonModule.productPictures && marathonModule.productPictures.length > 0 + ? marathonModule.productPictures[0]?.fullpath?.trim() + : undefined; + + const module: ModuleRules = { + partNumber: marathonModule.partNumber || externalId, + externalId: externalId, + description: + marathonModule.shortDescription || marathonModule.titleDescription || marathonModule.itemDescription || undefined, + thumbnailUrl: makeThumbnailUrlAndQueue( + sourceThumbnail, + `images/module/${marathonModule.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` + ), + // bundleUrl: module?.bundlePath?.fullpath?.trim() || undefined, + isSubmodule: marathonModule.isSubmodule || false, + hasPegs: marathonModule.hasPegs || false, + isMat: marathonModule.isMat || false, + shouldHideBasedOnWidth: + marathonModule.shouldHideBasedOnWidth !== undefined && marathonModule.shouldHideBasedOnWidth !== null + ? marathonModule.shouldHideBasedOnWidth + : true, + alwaysDisplay: marathonModule.alwaysDisplay || false, + isEdge: marathonModule.isEdge || false, + isImprintExtension: false, // False in this case, we'll manually set to true on the method regarding extensions + finish: { + externalId: marathonFinish.id, + slug: marathonFinish.slug || undefined + }, + collection: { + externalId: marathonCollection.id, + slug: marathonCollection.slug || undefined + }, + drawerTypes: marathonDrawerTypes.map((marathonDrawerType) => ({ + // Casting because we check previously right at the beginning and throw if it doesn't have an id + externalId: marathonDrawerType?.id as string, + slug: marathonDrawerType?.slug + })), + categories: marathonModule.spCategories + ?.filter((x) => x && !!x?.id) + .map((marathonCategory) => ({ + // Casting because we are filtering right above + externalId: marathonCategory?.id as string, + slug: marathonCategory?.slug + })), + otherFinishes, + dimensions, + rules, + extensions + }; + + return { + module, + attachments: makeAttachments(module, marathonModule), + extensions: makeExtensions(module, marathonModule), + alternative: marathonModule.alternative + ? { + ...module, + hasPegs: marathonModule.alternative.hasPegs || false, + partNumber: marathonModule.alternative.partNumber || `${module.partNumber}-B` + } + : undefined + }; +}; + +export const makeThumbnailUrlAndQueue = (sourcePath?: string | null, currentPath?: string | null) => { + let thumbnailUrl: string | undefined; + + if (sourcePath?.trim() && currentPath?.trim()) { + thumbnailUrl = replaceExtension(currentPath, sourcePath); + let originalPath = thumbnailUrl; + + // If the extension were changed, the paths are now different. So store the previous original path so the image can be deleted + if (currentPath !== originalPath) originalPath = currentPath; + + // TODO: Fix storage sync + // storageSyncQueue.push({ + // sourcePath, + // originalPath, + // destinationPath: thumbnailUrl + // }); + } + + return thumbnailUrl; }; -// TODO: Make a similar of this for extensions -export const makeQueueAppendRulesFromMarathonModule = ( +export const makeAttachments = ( + parent: ModuleRules, marathonModule: MarathonModule ): | { - append?: Partial; - queueModules?: Partial[]; + append: ModuleRules; + queueModules: ModuleRules[]; } | undefined => { // ---- Queue - const queueModules = marathonModule?.configuratorAttributes - ?.filter((attribute) => attribute?.description?.includes(FEATURE_NAMES.QUEUE_MODULES_ATTRIBUTE)) - ?.map((queueModuleAttribute) => - makeRulesWithAttributes( - queueModuleAttribute?.features, - () => - getInputFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)), - false, - () => - getMultiSelectFeature(queueModuleAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) - ) - ) - ); + const queueModules = marathonModule?.configuratorAttributes // Of all configurator attributes + ?.filter((attribute) => attribute?.description?.includes(FEATURE_NAMES.QUEUE_MODULES_ATTRIBUTE)) // We grab only the ones that includes the queue modules description + ?.map((queueModuleAttribute) => { + const partNumber = getInputFeature(queueModuleAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) + ); + + const otherFinishes = getMultiSelectFeature(queueModuleAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) + ); + + const dimensions = makeDimensionRulesFromAttribute(queueModuleAttribute?.features); + const rules = makeRulesObjectFromAttribute(queueModuleAttribute?.features); + + // const sourceThumbnail = getInputFeature(queueModuleAttribute?.features, FEATURE_NAMES.THUMBNAIL_URL); + const hasPegs = getBooleanSelectFeature(queueModuleAttribute?.features, FEATURE_NAMES.HAS_PEGS); + + return { + ...parent, + partNumber, + externalId: `${parent.externalId}-queue-${partNumber}`, + description: undefined, // They don't provide descriptions for nested modules + thumbnailUrl: undefined, // Not really used for queue modules + isSubmodule: true, // Not really used for queue modules but they are kinda like submodules + hasPegs: hasPegs || false, // Not used for queue modules + shouldHideBasedOnWidth: false, // Not used for queue modules + alwaysDisplay: false, // Queue modules don't show up as pegboard(this isn't even used) + isEdge: false, // Queue modules are never edge + isImprintExtension: false, + isMat: false, + otherFinishes, + + // Only those two are important for queue modules + dimensions, + rules + } as ModuleRules; + }); // ---- Append + // There should only be one append, as opposed of multiple queueModules + // so we grab the one that the description correctly match const appendModulesAttribute = marathonModule?.configuratorAttributes?.find( (attribute) => attribute?.description === FEATURE_NAMES.QUEUE_APPEND_ATTRIBUTE ); - if (!queueModules && !appendModulesAttribute) return undefined; + // Bail if there's none + if (!queueModules || queueModules.length <= 0 || !appendModulesAttribute) return undefined; + + const partNumber = getInputFeature(appendModulesAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) + ); + + const otherFinishes = getMultiSelectFeature(appendModulesAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) + ); + + const dimensions = makeDimensionRulesFromAttribute(appendModulesAttribute?.features); + const rules = makeRulesObjectFromAttribute(appendModulesAttribute?.features); + + // const sourceThumbnail = getInputFeature(appendModulesAttribute?.features, FEATURE_NAMES.THUMBNAIL_URL); + const hasPegs = getBooleanSelectFeature(appendModulesAttribute?.features, FEATURE_NAMES.HAS_PEGS); return { - append: appendModulesAttribute - ? makeRulesWithAttributes( - appendModulesAttribute?.features, - () => - getInputFeature(appendModulesAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) - ), - false, - () => - getMultiSelectFeature(appendModulesAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) - ) - ) - : undefined, + append: { + ...parent, + partNumber: partNumber || `${parent.externalId}-append`, + externalId: `${parent.externalId}-append-${partNumber}`, + description: undefined, // They don't provide descriptions for nested modules + thumbnailUrl: undefined, // Not really used for queue modules + isSubmodule: true, // Not really used for queue modules but they are kinda like submodules + hasPegs: hasPegs || false, // Not used for queue modules + shouldHideBasedOnWidth: false, // Not used for queue modules + alwaysDisplay: false, // Queue modules don't show up as pegboard(this isn't even used) + isEdge: false, // Queue modules are never edge + isImprintExtension: false, + isMat: false, + otherFinishes, + + // Only those two are important for queue modules + dimensions, + rules + }, queueModules }; }; -export const mergeRules = ( - marathonModule: MarathonModule, - currentRules?: NexusGenObjects['ModuleRules'] | null -): NexusGenObjects['ModuleRules'] | undefined => { - const partNumber = marathonModule?.partNumber?.trim() || currentRules?.partNumber; - if (!partNumber) throw makeError('Cannot create rule without partNumber', 'ruleMergeMissingPartNumber'); +export const makeExtensions = ( + parent: ModuleRules, + marathonModule: MarathonModule +): + | { + left: ModuleRules; + right: ModuleRules; + } + | undefined => { + // First, we grab the left and right extensions, using the expected attributes descriptions + + const leftExtensionAttribute = marathonModule?.configuratorAttributes?.find( + (attribute) => attribute?.description === FEATURE_NAMES.LEFT_EXTENSION_ATTRIBUTE + ); + + const rightExtensionAttribute = marathonModule?.configuratorAttributes?.find( + (attribute) => attribute?.description === FEATURE_NAMES.RIGHT_EXTENSION_ATTRIBUTE + ); + + // Bail if there's none + if (!leftExtensionAttribute || !rightExtensionAttribute) return undefined; + + // Then, for some reason, extensions finishes are not arrays but a single input like everything else 🤷 so lets grab them too + + const leftPartNumber = getInputFeature(leftExtensionAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) + ); + const leftFinish = getInputFeature(leftExtensionAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) + ); + const leftOtherFinishes = leftFinish ? [leftFinish] : undefined; + const leftDimensions = makeDimensionRulesFromAttribute(leftExtensionAttribute?.features); + const leftRules = makeRulesObjectFromAttribute(leftExtensionAttribute?.features); + const leftThumbnail = getInputFeature(leftExtensionAttribute?.features, FEATURE_NAMES.PRODUCT_PICTURE_FULL_PATH); - const marathonRules = makeRulesFromMarathonModule(marathonModule); + const rightPartNumber = getInputFeature(rightExtensionAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) + ); + const rightFinish = getInputFeature(rightExtensionAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) + ); + const rightOtherFinishes = rightFinish ? [rightFinish] : undefined; + const rightDimensions = makeDimensionRulesFromAttribute(rightExtensionAttribute?.features); + const rightRules = makeRulesObjectFromAttribute(rightExtensionAttribute?.features); + const rightThumbnail = getInputFeature(rightExtensionAttribute?.features, FEATURE_NAMES.PRODUCT_PICTURE_FULL_PATH); + + return { + // And convert them to the format we expect + left: { + ...parent, + partNumber: leftPartNumber || `${parent.externalId}-left-extension`, + externalId: `${parent.externalId}-left-extension-${leftPartNumber}`, + description: undefined, // They don't provide descriptions for nested modules + thumbnailUrl: makeThumbnailUrlAndQueue( + leftThumbnail, + `images/module/${marathonModule.partNumber?.trim()}${path.extname(leftThumbnail || '')}` + ), + isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules + hasPegs: false, // Not used for extensions + shouldHideBasedOnWidth: false, // Not used for extensions + alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) + isEdge: false, // extensions are never edge, + isImprintExtension: true, + isMat: false, + otherFinishes: leftOtherFinishes, + dimensions: leftDimensions, + rules: leftRules + }, + right: { + ...parent, + partNumber: rightPartNumber || `${parent.externalId}-right-extension-${rightPartNumber}`, + externalId: `${parent.externalId}-right-extension-${rightPartNumber}`, + description: undefined, // They don't provide descriptions for nested modules + thumbnailUrl: makeThumbnailUrlAndQueue( + rightThumbnail, + `images/module/${marathonModule.partNumber?.trim()}${path.extname(rightThumbnail || '')}` + ), + isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules + hasPegs: false, // Not used for extensions + shouldHideBasedOnWidth: false, // Not used for extensions + alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) + isEdge: false, // extensions are never edge, + isImprintExtension: true, + isMat: false, + otherFinishes: rightOtherFinishes, + dimensions: rightDimensions, + rules: rightRules + } + }; +}; +export const mergeRules = (marathonRules: ModuleRules, currentRules?: ModuleRules | null): ModuleRules | undefined => { + // If we already have rules, we merge ours with marathon but making sure marathon's will override ours. If not, we just return marathon's return currentRules ? deepmerge(currentRules, marathonRules, { // combine arrays using object equality (like in sets) diff --git a/src/utils/types.ts b/src/utils/types.ts new file mode 100644 index 0000000..5cd54d9 --- /dev/null +++ b/src/utils/types.ts @@ -0,0 +1,4 @@ +export type NoNullFields = { + // eslint-disable-next-line @typescript-eslint/ban-types + [K in keyof Ob]: Ob[K] extends object ? NoNullFields : NonNullable; +}; From d5192f3700504d42f3bd07f39776c148e737ae75 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Tue, 26 Apr 2022 11:50:20 -0300 Subject: [PATCH 06/13] feat: finished all schemas --- .../migration.sql | 2 + prisma/schema.prisma | 1 + prisma/seed.ts | 406 ++++---- src/cron.ts | 4 +- src/generated/nexus-prisma.d.ts | 25 +- src/generated/nexus.d.ts | 42 +- src/generated/schema.graphql | 36 +- src/schema/moduleRules.ts | 2 +- src/services/marathon/index.ts | 942 +++++++++++------- src/services/marathon/parsing/constants.ts | 1 + src/services/marathon/parsing/parseRules.ts | 157 +-- 11 files changed, 956 insertions(+), 662 deletions(-) create mode 100644 prisma/migrations/20220425145821_add_original_marathon_json_field/migration.sql diff --git a/prisma/migrations/20220425145821_add_original_marathon_json_field/migration.sql b/prisma/migrations/20220425145821_add_original_marathon_json_field/migration.sql new file mode 100644 index 0000000..05161b7 --- /dev/null +++ b/prisma/migrations/20220425145821_add_original_marathon_json_field/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `Module` ADD COLUMN `originalMarathonProductJson` JSON; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ec32663..21b98ac 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -128,6 +128,7 @@ model Module { collectionId Int collection Collection @relation(fields: [collectionId], references: [id]) rules Json? + originalMarathonProductJson Json? projectModules ProjectModule[] moduleCategories ModuleCategory[] defaultLeftExtensionParents Module[] @relation("defaultLeftExtensionRelation") diff --git a/prisma/seed.ts b/prisma/seed.ts index bf4a9f4..57fb2e3 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -7,226 +7,202 @@ const db = new PrismaClient(); const main = async () => { // -- Collections - await db.collection.createMany({ - data: seedValues.collections.map(({ slug, thumbnailUrl, hasPegs, isComingSoon }) => ({ - slug: slug.toLowerCase(), - thumbnailUrl, - isComingSoon: isComingSoon || false, - hasPegs: hasPegs || false - })) - }); - - const collections = await db.collection.findMany({ select: { id: true, slug: true } }); - - await db.collectionTranslations.createMany({ - data: seedValues.collections - .flatMap((x) => - x.translations.map((y) => ({ - ...y, - collectionSlug: x.slug.toLowerCase() - })) - ) - .map(({ locale, collectionSlug, ...collectionTranslation }) => ({ - locale: locale as Locale, - collectionId: collections.find((x) => x.slug === collectionSlug)?.id || -1, - ...collectionTranslation - })) - }); - + // await db.collection.createMany({ + // data: seedValues.collections.map(({ slug, thumbnailUrl, hasPegs, isComingSoon }) => ({ + // slug: slug.toLowerCase(), + // thumbnailUrl, + // isComingSoon: isComingSoon || false, + // hasPegs: hasPegs || false + // })) + // }); + // const collections = await db.collection.findMany({ select: { id: true, slug: true } }); + // await db.collectionTranslations.createMany({ + // data: seedValues.collections + // .flatMap((x) => + // x.translations.map((y) => ({ + // ...y, + // collectionSlug: x.slug.toLowerCase() + // })) + // ) + // .map(({ locale, collectionSlug, ...collectionTranslation }) => ({ + // locale: locale as Locale, + // collectionId: collections.find((x) => x.slug === collectionSlug)?.id || -1, + // ...collectionTranslation + // })) + // }); // -- Finishes - await db.finish.createMany({ - data: seedValues.finishes.map(({ name, thumbnailUrl }) => ({ - thumbnailUrl, - slug: helpers.slugify(name).toLowerCase() - })) - }); - - const finishes = await db.finish.findMany({ select: { id: true, slug: true } }); - - await db.finishTranslations.createMany({ - data: seedValues.finishes.map(({ name }) => ({ - locale: 'en' as Locale, - name, - finishId: finishes.find((x) => x.slug === helpers.slugify(name).toLowerCase())?.id || -1 - })) - }); - - // -- Collection finishes - await db.collectionFinishes.createMany({ - data: seedValues.collectionFinishes.map(({ collection, finish }) => ({ - finishId: finishes.find((x) => x.slug === helpers.slugify(finish).toLowerCase())?.id || -1, - collectionId: collections.find((x) => x.slug === collection)?.id || -1 - })) - }); - + // await db.finish.createMany({ + // data: seedValues.finishes.map(({ name, thumbnailUrl }) => ({ + // thumbnailUrl, + // slug: helpers.slugify(name).toLowerCase() + // })) + // }); + // const finishes = await db.finish.findMany({ select: { id: true, slug: true } }); + // await db.finishTranslations.createMany({ + // data: seedValues.finishes.map(({ name }) => ({ + // locale: 'en' as Locale, + // name, + // finishId: finishes.find((x) => x.slug === helpers.slugify(name).toLowerCase())?.id || -1 + // })) + // }); + // // -- Collection finishes + // await db.collectionFinishes.createMany({ + // data: seedValues.collectionFinishes.map(({ collection, finish }) => ({ + // finishId: finishes.find((x) => x.slug === helpers.slugify(finish).toLowerCase())?.id || -1, + // collectionId: collections.find((x) => x.slug === collection)?.id || -1 + // })) + // }); // -- Types - await db.type.createMany({ - data: seedValues.types.map(({ slug, thumbnailUrl, hasPegs }) => ({ - slug: slug.toLowerCase(), - thumbnailUrl, - hasPegs: hasPegs || false - })) - }); - - const types = await db.type.findMany({ select: { id: true, slug: true } }); - - await db.typeTranslations.createMany({ - data: seedValues.types - .flatMap((x) => - x.translations.map((y) => ({ - ...y, - typeSlug: x.slug.toLowerCase() - })) - ) - .map(({ locale, typeSlug, ...typeTranslation }) => ({ - locale: locale as Locale, - typeId: types.find((x) => x.slug === typeSlug)?.id || -1, - ...typeTranslation - })) - }); - + // await db.type.createMany({ + // data: seedValues.types.map(({ slug, thumbnailUrl, hasPegs }) => ({ + // slug: slug.toLowerCase(), + // thumbnailUrl, + // hasPegs: hasPegs || false + // })) + // }); + // const types = await db.type.findMany({ select: { id: true, slug: true } }); + // await db.typeTranslations.createMany({ + // data: seedValues.types + // .flatMap((x) => + // x.translations.map((y) => ({ + // ...y, + // typeSlug: x.slug.toLowerCase() + // })) + // ) + // .map(({ locale, typeSlug, ...typeTranslation }) => ({ + // locale: locale as Locale, + // typeId: types.find((x) => x.slug === typeSlug)?.id || -1, + // ...typeTranslation + // })) + // }); // -- Slides - - await db.slideSupplier.createMany({ - data: uniqBy(seedValues.slides, 'supplier').map((x) => ({ - slug: helpers.slugify(x.supplier).toLowerCase(), - thumbnailUrl: seedValues.supplierLogos.find((y) => y.supplier === helpers.slugify(x.supplier).toLowerCase()) - ?.supplierImgURL, - name: x.supplier - })) - }); - - const slideSuppliers = await db.slideSupplier.findMany({ select: { id: true, slug: true } }); - - const depths: ({ slug: string } & typeof seedValues['slides'][number]['depth'][number])[] = []; - - await db.slide.createMany({ - data: seedValues.slides.map(({ formula, product, collection, supplier, depth }) => { - const slug = helpers.slugify(`${supplier}-${product}-${collection}`).toLowerCase(); - depth.forEach((y) => depths.push({ slug, ...y })); - return { - slug, - formula, - product, - collectionId: collections.find((x) => x.slug === helpers.slugify(collection).toLowerCase())?.id || -1, - supplierId: slideSuppliers.find((x) => x.slug === helpers.slugify(supplier).toLowerCase())?.id || -1 - }; - }) - }); - - const slides = await db.slide.findMany({ select: { id: true, slug: true } }); - - await db.slideDepth.createMany({ - data: depths.map(({ slug, roundedValue, value }) => ({ - display: `${roundedValue}mm`, - depth: toNumber(value), - slideId: slides.find((x) => x.slug === slug)?.id || -1 - })) - }); - + // await db.slideSupplier.createMany({ + // data: uniqBy(seedValues.slides, 'supplier').map((x) => ({ + // slug: helpers.slugify(x.supplier).toLowerCase(), + // thumbnailUrl: seedValues.supplierLogos.find((y) => y.supplier === helpers.slugify(x.supplier).toLowerCase()) + // ?.supplierImgURL, + // name: x.supplier + // })) + // }); + // const slideSuppliers = await db.slideSupplier.findMany({ select: { id: true, slug: true } }); + // const depths: ({ slug: string } & typeof seedValues['slides'][number]['depth'][number])[] = []; + // await db.slide.createMany({ + // data: seedValues.slides.map(({ formula, product, collection, supplier, depth }) => { + // const slug = helpers.slugify(`${supplier}-${product}-${collection}`).toLowerCase(); + // depth.forEach((y) => depths.push({ slug, ...y })); + // return { + // slug, + // formula, + // product, + // collectionId: collections.find((x) => x.slug === helpers.slugify(collection).toLowerCase())?.id || -1, + // supplierId: slideSuppliers.find((x) => x.slug === helpers.slugify(supplier).toLowerCase())?.id || -1 + // }; + // }) + // }); + // const slides = await db.slide.findMany({ select: { id: true, slug: true } }); + // await db.slideDepth.createMany({ + // data: depths.map(({ slug, roundedValue, value }) => ({ + // display: `${roundedValue}mm`, + // depth: toNumber(value), + // slideId: slides.find((x) => x.slug === slug)?.id || -1 + // })) + // }); // -- Categories - await db.category.createMany({ - data: seedValues.categories.map(({ slug, name }) => ({ - name, - slug - })) - }); - - const categories = await db.category.findMany({ select: { id: true, slug: true } }); - + // await db.category.createMany({ + // data: seedValues.categories.map(({ slug, name }) => ({ + // name, + // slug + // })) + // }); + // const categories = await db.category.findMany({ select: { id: true, slug: true } }); // -- Modules - await db.module.createMany({ - data: seedValues.modules - .filter((x) => !!x.collection && !!x.finish) - .map( - ({ - partNumber, - rules, - finish, - collection, - isSubmodule, - hasPegs, - bundlePath, - imageUrl, - isMat, - shouldHideBasedOnWidth, - isExtension, - isEdge - }) => { - return { - thumbnailUrl: imageUrl, - partNumber, - bundleUrl: bundlePath, - isSubmodule, - hasPegs, - isMat, - isExtension, - shouldHideBasedOnWidth, - isEdge, - rules: rules ? JSON.parse(rules) : undefined, - collectionId: collections.find((x) => x.slug === helpers.slugify(collection).toLowerCase())?.id || -1, - finishId: finishes.find((x) => x.slug === helpers.slugify(finish).toLowerCase())?.id || -1 - }; - } - ) - }); - - const modules = await db.module.findMany({ select: { id: true, partNumber: true } }); - - await db.moduleType.createMany({ - data: seedValues.moduleTypes.map(({ partNumber, type }) => ({ - typeId: types.find((f) => f.slug === type)?.id || -1, - moduleId: modules.find((f) => f.partNumber === partNumber)?.id || -1 - })) - }); - - const moduleWithExtensions = seedValues.modules.filter((x) => x.defaultLeftExtension || x.defaultRightExtension); - for (const module of moduleWithExtensions) { - const extensionLeft = modules.find((x) => x.partNumber === module.defaultLeftExtension); - const extensionRight = modules.find((x) => x.partNumber === module.defaultRightExtension); - await db.module.update({ - where: { - partNumber: module.partNumber - }, - data: { - defaultLeftExtensionId: extensionLeft?.id || undefined, - defaultRightExtensionId: extensionRight?.id || undefined - } - }); - } - - const moduleWithAttachments = seedValues.modules.filter((x) => x.moduleAttachments || x.attachmentToAppend); - for (const module of moduleWithAttachments) { - const attachments = modules.filter((x) => moduleWithAttachments.some((y) => x.partNumber === y.partNumber)); - const appendAttachment = modules.find((x) => x.partNumber === module.attachmentToAppend); - await db.module.update({ - where: { - partNumber: module.partNumber - }, - data: { - attachmentToAppendId: appendAttachment?.id || undefined, - moduleAttachments: { - createMany: { - data: attachments.map((x) => ({ attachmentId: x.id })) - } - } - } - }); - } - - // Automatically puts modules in "all" category - const toCreate: { categoryId: number; moduleId: number }[] = []; - seedValues.modules.forEach((module) => { - module.categorySlug?.forEach((category) => { - toCreate.push({ - categoryId: categories.find((f) => f.slug === category)?.id || -1, - moduleId: modules.find((f) => f.partNumber === module.partNumber)?.id || -1 - }); - }); - }); - await db.moduleCategory.createMany({ - data: toCreate - }); + // await db.module.createMany({ + // data: seedValues.modules + // .filter((x) => !!x.collection && !!x.finish) + // .map( + // ({ + // partNumber, + // rules, + // finish, + // collection, + // isSubmodule, + // hasPegs, + // bundlePath, + // imageUrl, + // isMat, + // shouldHideBasedOnWidth, + // isExtension, + // isEdge + // }) => { + // return { + // thumbnailUrl: imageUrl, + // partNumber, + // bundleUrl: bundlePath, + // isSubmodule, + // hasPegs, + // isMat, + // isExtension, + // shouldHideBasedOnWidth, + // isEdge, + // rules: rules ? JSON.parse(rules) : undefined, + // collectionId: collections.find((x) => x.slug === helpers.slugify(collection).toLowerCase())?.id || -1, + // finishId: finishes.find((x) => x.slug === helpers.slugify(finish).toLowerCase())?.id || -1 + // }; + // } + // ) + // }); + // const modules = await db.module.findMany({ select: { id: true, partNumber: true } }); + // await db.moduleType.createMany({ + // data: seedValues.moduleTypes.map(({ partNumber, type }) => ({ + // typeId: types.find((f) => f.slug === type)?.id || -1, + // moduleId: modules.find((f) => f.partNumber === partNumber)?.id || -1 + // })) + // }); + // const moduleWithExtensions = seedValues.modules.filter((x) => x.defaultLeftExtension || x.defaultRightExtension); + // for (const module of moduleWithExtensions) { + // const extensionLeft = modules.find((x) => x.partNumber === module.defaultLeftExtension); + // const extensionRight = modules.find((x) => x.partNumber === module.defaultRightExtension); + // await db.module.update({ + // where: { + // partNumber: module.partNumber + // }, + // data: { + // defaultLeftExtensionId: extensionLeft?.id || undefined, + // defaultRightExtensionId: extensionRight?.id || undefined + // } + // }); + // } + // const moduleWithAttachments = seedValues.modules.filter((x) => x.moduleAttachments || x.attachmentToAppend); + // for (const module of moduleWithAttachments) { + // const attachments = modules.filter((x) => moduleWithAttachments.some((y) => x.partNumber === y.partNumber)); + // const appendAttachment = modules.find((x) => x.partNumber === module.attachmentToAppend); + // await db.module.update({ + // where: { + // partNumber: module.partNumber + // }, + // data: { + // attachmentToAppendId: appendAttachment?.id || undefined, + // moduleAttachments: { + // createMany: { + // data: attachments.map((x) => ({ attachmentId: x.id })) + // } + // } + // } + // }); + // } + // // Automatically puts modules in "all" category + // const toCreate: { categoryId: number; moduleId: number }[] = []; + // seedValues.modules.forEach((module) => { + // module.categorySlug?.forEach((category) => { + // toCreate.push({ + // categoryId: categories.find((f) => f.slug === category)?.id || -1, + // moduleId: modules.find((f) => f.partNumber === module.partNumber)?.id || -1 + // }); + // }); + // }); + // await db.moduleCategory.createMany({ + // data: toCreate + // }); }; let error = false; diff --git a/src/cron.ts b/src/cron.ts index 41553ca..e08c955 100644 --- a/src/cron.ts +++ b/src/cron.ts @@ -11,7 +11,7 @@ const scheduleJobs = async (prisma: PrismaClient): Promise => { const marathon = marathonService({ db: prisma }); if (MARATHON_API_SYNC === 'true') { - marathon.syncData(true); + marathon.syncData(); } cron.schedule( @@ -21,7 +21,7 @@ const scheduleJobs = async (prisma: PrismaClient): Promise => { if (MARATHON_API_SYNC === 'true') { try { - await marathon.syncData(true); + await marathon.syncData(); } catch (error) { logging.error(error, 'Daily cronjob has failed.'); } diff --git a/src/generated/nexus-prisma.d.ts b/src/generated/nexus-prisma.d.ts index 435bf55..fc1607b 100644 --- a/src/generated/nexus-prisma.d.ts +++ b/src/generated/nexus-prisma.d.ts @@ -75,8 +75,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'moduleId' | 'attachmentId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } projects: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'type' | 'collectionId' | 'collection' | 'finishId' | 'finish' | 'slideId' | 'slide' | 'slideDepthId' | 'slideDepth' | 'userId' | 'user' | 'projectModules' | 'lists' @@ -138,8 +138,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'collectionId' | 'finishId' | 'slideId' | 'slideDepthId' | 'userId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } collectionFinishes: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'collectionId' | 'collection' | 'finishId' | 'finish' @@ -166,8 +166,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'collectionId' | 'finishId' | 'slideId' | 'slideDepthId' | 'userId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } collectionFinishes: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'collectionId' | 'collection' | 'finishId' | 'finish' @@ -193,16 +193,16 @@ interface NexusPrismaInputs { ordering: 'id' | 'moduleId' | 'categoryId' } defaultLeftExtensionParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } defaultRightExtensionParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } attachmentToAppendParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } moduleAttachments: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'moduleId' | 'module' | 'attachmentId' | 'attachment' @@ -559,6 +559,7 @@ interface NexusPrismaOutputs { collectionId: 'Int' collection: 'Collection' rules: 'Json' + originalMarathonProductJson: 'Json' projectModules: 'ProjectModule' moduleCategories: 'ModuleCategory' defaultLeftExtensionParents: 'Module' diff --git a/src/generated/nexus.d.ts b/src/generated/nexus.d.ts index ad9d80b..71bc403 100644 --- a/src/generated/nexus.d.ts +++ b/src/generated/nexus.d.ts @@ -1307,6 +1307,7 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1335,6 +1336,7 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1363,6 +1365,7 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1391,6 +1394,7 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1419,6 +1423,7 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1590,6 +1595,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1620,6 +1626,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1650,6 +1657,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1680,6 +1688,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1710,6 +1719,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1740,6 +1750,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1770,6 +1781,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1800,6 +1812,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1830,6 +1843,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1860,6 +1874,7 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1890,6 +1905,7 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1921,6 +1937,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1951,6 +1968,7 @@ export interface NexusGenInputs { isExtension?: NexusGenEnums['SortOrder'] | null; // SortOrder isMat?: NexusGenEnums['SortOrder'] | null; // SortOrder isSubmodule?: NexusGenEnums['SortOrder'] | null; // SortOrder + originalMarathonProductJson?: NexusGenEnums['SortOrder'] | null; // SortOrder partNumber?: NexusGenEnums['SortOrder'] | null; // SortOrder rules?: NexusGenEnums['SortOrder'] | null; // SortOrder shouldHideBasedOnWidth?: NexusGenEnums['SortOrder'] | null; // SortOrder @@ -1978,6 +1996,7 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFilter'] | null; // BoolFilter isMat?: NexusGenInputs['BoolFilter'] | null; // BoolFilter isSubmodule?: NexusGenInputs['BoolFilter'] | null; // BoolFilter + originalMarathonProductJson?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter partNumber?: NexusGenInputs['StringFilter'] | null; // StringFilter rules?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter shouldHideBasedOnWidth?: NexusGenInputs['BoolFilter'] | null; // BoolFilter @@ -2150,6 +2169,7 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2361,6 +2381,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2391,6 +2412,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2421,6 +2443,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2451,6 +2474,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2481,6 +2505,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2511,6 +2536,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2541,6 +2567,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2571,6 +2598,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2601,6 +2629,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2631,6 +2660,7 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2661,6 +2691,7 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2692,6 +2723,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2796,6 +2828,7 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsListRelationFilter'] | null; // ModuleAttachmentsListRelationFilter moduleCategories?: NexusGenInputs['ModuleCategoryListRelationFilter'] | null; // ModuleCategoryListRelationFilter moduleType?: NexusGenInputs['ModuleTypeListRelationFilter'] | null; // ModuleTypeListRelationFilter + originalMarathonProductJson?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter partNumber?: NexusGenInputs['StringFilter'] | null; // StringFilter projectModules?: NexusGenInputs['ProjectModuleListRelationFilter'] | null; // ProjectModuleListRelationFilter rules?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter @@ -4864,6 +4897,7 @@ export interface NexusGenObjects { isExtension: boolean; // Boolean! isMat: boolean; // Boolean! isSubmodule: boolean; // Boolean! + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! shouldHideBasedOnWidth: boolean; // Boolean! updatedAt: NexusGenScalars['DateTime']; // DateTime! @@ -4931,7 +4965,7 @@ export interface NexusGenObjects { finish: NexusGenRootTypes['ModuleFinishesMetadata']; // ModuleFinishesMetadata! hasPegs?: boolean | null; // Boolean isEdge?: boolean | null; // Boolean - isImprintExtension: boolean; // Boolean! + isExtension: boolean; // Boolean! isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean otherFinishes?: string[] | null; // [String!] @@ -5181,6 +5215,7 @@ export interface NexusGenFieldTypes { moduleAttachedTo: NexusGenRootTypes['ModuleAttachments'][]; // [ModuleAttachments!]! moduleAttachments: NexusGenRootTypes['ModuleAttachments'][]; // [ModuleAttachments!]! moduleType: NexusGenRootTypes['ModuleType'][]; // [ModuleType!]! + originalMarathonProductJson: NexusGenScalars['Json'] | null; // Json partNumber: string; // String! projectModules: NexusGenRootTypes['ProjectModule'][]; // [ProjectModule!]! rules: NexusGenRootTypes['ModuleRules'] | null; // ModuleRules @@ -5256,7 +5291,7 @@ export interface NexusGenFieldTypes { finish: NexusGenRootTypes['ModuleFinishesMetadata']; // ModuleFinishesMetadata! hasPegs: boolean | null; // Boolean isEdge: boolean | null; // Boolean - isImprintExtension: boolean; // Boolean! + isExtension: boolean; // Boolean! isMat: boolean | null; // Boolean isSubmodule: boolean | null; // Boolean otherFinishes: string[] | null; // [String!] @@ -5571,6 +5606,7 @@ export interface NexusGenFieldTypeNames { moduleAttachedTo: 'ModuleAttachments'; moduleAttachments: 'ModuleAttachments'; moduleType: 'ModuleType'; + originalMarathonProductJson: 'Json'; partNumber: 'String'; projectModules: 'ProjectModule'; rules: 'ModuleRules'; @@ -5646,7 +5682,7 @@ export interface NexusGenFieldTypeNames { finish: 'ModuleFinishesMetadata'; hasPegs: 'Boolean'; isEdge: 'Boolean'; - isImprintExtension: 'Boolean'; + isExtension: 'Boolean'; isMat: 'Boolean'; isSubmodule: 'Boolean'; otherFinishes: 'String'; diff --git a/src/generated/schema.graphql b/src/generated/schema.graphql index 5cbf8a7..abb5ec1 100644 --- a/src/generated/schema.graphql +++ b/src/generated/schema.graphql @@ -1177,6 +1177,7 @@ type Module { moduleAttachedTo(cursor: ModuleAttachmentsWhereUniqueInput, skip: Int, take: Int): [ModuleAttachments!]! moduleAttachments(cursor: ModuleAttachmentsWhereUniqueInput, skip: Int, take: Int): [ModuleAttachments!]! moduleType(cursor: ModuleTypeWhereUniqueInput, skip: Int, take: Int): [ModuleType!]! + originalMarathonProductJson: Json partNumber: String! projectModules( cursor: ProjectModuleWhereUniqueInput @@ -1488,6 +1489,7 @@ input ModuleCreateManyAttachmentToAppendInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + originalMarathonProductJson: Json partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1516,6 +1518,7 @@ input ModuleCreateManyCollectionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + originalMarathonProductJson: Json partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1544,6 +1547,7 @@ input ModuleCreateManyDefaultLeftExtensionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + originalMarathonProductJson: Json partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1572,6 +1576,7 @@ input ModuleCreateManyDefaultRightExtensionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + originalMarathonProductJson: Json partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1600,6 +1605,7 @@ input ModuleCreateManyFinishInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + originalMarathonProductJson: Json partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1771,6 +1777,7 @@ input ModuleCreateWithoutAttachmentToAppendInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1801,6 +1808,7 @@ input ModuleCreateWithoutAttachmentToAppendParentsInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1831,6 +1839,7 @@ input ModuleCreateWithoutCollectionInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1861,6 +1870,7 @@ input ModuleCreateWithoutDefaultLeftExtensionInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1891,6 +1901,7 @@ input ModuleCreateWithoutDefaultLeftExtensionParentsInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1921,6 +1932,7 @@ input ModuleCreateWithoutDefaultRightExtensionInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1951,6 +1963,7 @@ input ModuleCreateWithoutDefaultRightExtensionParentsInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1981,6 +1994,7 @@ input ModuleCreateWithoutFinishInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2011,6 +2025,7 @@ input ModuleCreateWithoutModuleAttachedToInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2041,6 +2056,7 @@ input ModuleCreateWithoutModuleAttachmentsInput { moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2071,6 +2087,7 @@ input ModuleCreateWithoutModuleTypeInput { moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2102,6 +2119,7 @@ input ModuleCreateWithoutProjectModulesInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -2159,6 +2177,7 @@ input ModuleOrderByInput { isExtension: SortOrder isMat: SortOrder isSubmodule: SortOrder + originalMarathonProductJson: SortOrder partNumber: SortOrder rules: SortOrder shouldHideBasedOnWidth: SortOrder @@ -2187,7 +2206,7 @@ type ModuleRules { finish: ModuleFinishesMetadata! hasPegs: Boolean isEdge: Boolean - isImprintExtension: Boolean! + isExtension: Boolean! isMat: Boolean isSubmodule: Boolean @@ -2273,6 +2292,7 @@ input ModuleScalarWhereInput { isExtension: BoolFilter isMat: BoolFilter isSubmodule: BoolFilter + originalMarathonProductJson: JsonNullableFilter partNumber: StringFilter rules: JsonNullableFilter shouldHideBasedOnWidth: BoolFilter @@ -2458,6 +2478,7 @@ input ModuleUpdateManyMutationInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput rules: Json shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput @@ -2669,6 +2690,7 @@ input ModuleUpdateWithoutAttachmentToAppendInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2699,6 +2721,7 @@ input ModuleUpdateWithoutAttachmentToAppendParentsInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2729,6 +2752,7 @@ input ModuleUpdateWithoutCollectionInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2759,6 +2783,7 @@ input ModuleUpdateWithoutDefaultLeftExtensionInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2789,6 +2814,7 @@ input ModuleUpdateWithoutDefaultLeftExtensionParentsInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2819,6 +2845,7 @@ input ModuleUpdateWithoutDefaultRightExtensionInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2849,6 +2876,7 @@ input ModuleUpdateWithoutDefaultRightExtensionParentsInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2879,6 +2907,7 @@ input ModuleUpdateWithoutFinishInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2909,6 +2938,7 @@ input ModuleUpdateWithoutModuleAttachedToInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2939,6 +2969,7 @@ input ModuleUpdateWithoutModuleAttachmentsInput { moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2969,6 +3000,7 @@ input ModuleUpdateWithoutModuleTypeInput { moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -3000,6 +3032,7 @@ input ModuleUpdateWithoutProjectModulesInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json partNumber: StringFieldUpdateOperationsInput rules: Json shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput @@ -3104,6 +3137,7 @@ input ModuleWhereInput { moduleAttachments: ModuleAttachmentsListRelationFilter moduleCategories: ModuleCategoryListRelationFilter moduleType: ModuleTypeListRelationFilter + originalMarathonProductJson: JsonNullableFilter partNumber: StringFilter projectModules: ProjectModuleListRelationFilter rules: JsonNullableFilter diff --git a/src/schema/moduleRules.ts b/src/schema/moduleRules.ts index 02b6266..f51317d 100644 --- a/src/schema/moduleRules.ts +++ b/src/schema/moduleRules.ts @@ -164,7 +164,7 @@ export const ModuleRules = objectType({ t.boolean('alwaysDisplay'); t.boolean('isEdge'); - t.nonNull.boolean('isImprintExtension'); + t.nonNull.boolean('isExtension'); t.list.string('trims', { description: 'Different types of edges a module might have' diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index e0c82e6..cecb34d 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -3,8 +3,11 @@ import { Locale, Module, PrismaClient } from '@prisma/client'; import { ForbiddenError } from 'apollo-server'; import axios, { AxiosResponse } from 'axios'; import fetch from 'cross-fetch'; +import { helpers } from 'faker'; +import { toNumber } from 'lodash'; import path from 'path'; import { URL } from 'url'; +import seed from '../../../prisma/seedValues/seed.json'; import { env } from '../../env'; import { GetProductListingQuery, @@ -14,14 +17,13 @@ import { GetSpDrawerTypesListingQuery, GetSpFinishListingQuery } from '../../generated/graphql'; -import { NexusGenObjects } from '../../generated/nexus'; import { makeError } from '../../utils/exception'; import { makeFile } from '../../utils/file'; import logging from '../../utils/logging'; import { fileUploadService } from '../fileUpload'; import { projectService } from '../project'; import { MarathonModule, ModuleRules } from './parsing/constants'; -import { makeRulesFromMarathonModule, makeThumbnailUrlAndQueue, mergeRules } from './parsing/parseRules'; +import { makeRulesFromMarathonModule, mergeRules } from './parsing/parseRules'; import { GET_PRODUCT_LISTING, GET_SP_CATEGORY_LISTING, @@ -72,11 +74,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { cache: new InMemoryCache() }); - const storageSyncQueue: { - sourcePath: string; - originalPath: string; - destinationPath: string; - }[] = []; + const storageSyncQueue: string[] = []; + const imagesNotFound: string[] = []; const storageSync = async () => { if (!MARATHON_MEDIA_URI) { @@ -96,7 +95,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const promises: Promise[] = []; for (let index = 0; index < simultaneousSync; index++) { - const storageSync = storageSyncQueue[index]; + const imagePath = storageSyncQueue[index]; promises.push( new Promise(async (resolve, reject) => { @@ -104,16 +103,26 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Syncing image #${i + 1} of ${initialLength}`); i++; - // Download image - const file = await fileUpload.downloadFile( - new URL(storageSync.sourcePath, MARATHON_MEDIA_URI).toString() - ); + try { + // Download image + const file = await fileUpload.downloadFile(new URL(imagePath, MARATHON_MEDIA_URI).toString()); - // Try to delete current image - await fileUpload.DELETEFilesOnStorageCAUTION([storageSync.originalPath]); + try { + // Try to delete current image, but only if managed to download previously + await fileUpload.DELETEFilesOnStorageCAUTION([imagePath]); + } catch { + // Do nothing, file probably doesn't exist + } - // Upload new image - await fileUpload.uploadFileToStorage(file.data, storageSync.destinationPath); + // Upload new image + await fileUpload.uploadFileToStorage(file.data, imagePath); + } catch (err: any) { + if (err?.response?.status && err.response.status === 404) { + imagesNotFound.push(new URL(imagePath, MARATHON_MEDIA_URI).toString()); + } else { + logging.error(err, 'Could not sync image'); + } + } resolve(); } catch (err) { reject(err); @@ -135,6 +144,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } console.log('Finished syncing images'); + + if (imagesNotFound.length > 0) { + logging.warn('These images returned 404', { missingFiles: imagesNotFound }); + } }; const syncCategory = async (skipDatabase?: boolean) => { @@ -156,18 +169,9 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetched ${categories.length} categories`); if (!skipDatabase && categories && categories.length > 0) { - const ids = categories - .map((categoryEdge) => categoryEdge?.node?.id as string) // Casting because we're filtering right after - .filter((x) => !!x); - // Get all categories that we already have const existingCategories = await db.category.findMany({ - select: { externalId: true }, - where: { - externalId: { - in: ids - } - } + select: { externalId: true, slug: true } }); // Received categories @@ -182,13 +186,17 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { (categoryEdge) => !existingCategories.some((cat) => cat.externalId === categoryEdge?.node?.id) ); + const categoriesWithSlug = existingCategories.filter((cat) => + categoriesToCreate.some((categoryEdge) => categoryEdge?.node?.slug === cat.slug) + ); + for (let i = 0; i < categoriesToUpdate.length; i++) { const categoryEdge = categoriesToUpdate[i]; const id = categoryEdge?.node?.id; if (!id) continue; - console.log(`Updating category #${i + 1} id: ${id} of ${categoriesToUpdate.length}`); + console.log(`Updating category id: ${id} #${i + 1} of ${categoriesToUpdate.length}`); await db.category.update({ where: { externalId: id }, @@ -204,17 +212,38 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await db.category.createMany({ data: categoriesToCreate .filter((categoryEdge) => categoryEdge?.node?.id && categoryEdge?.node?.slug && categoryEdge?.node?.name) - .map((categoryEdge) => ({ - // Casting because we're sure, since there's a filter right above - externalId: categoryEdge?.node?.id as string, - slug: categoryEdge?.node?.slug?.trim() as string, - name: categoryEdge?.node?.name?.trim() as string - })) + .map((categoryEdge) => { + let slug = categoryEdge?.node?.slug?.trim() as string; + + const sameSlugCategories = categoriesWithSlug.filter((cat) => cat.slug === slug); + if (sameSlugCategories?.length > 0) { + slug = `${slug}-${sameSlugCategories.length}`; + } + + return { + // Casting because we're sure, since there's a filter right above + externalId: categoryEdge?.node?.id as string, + slug, + name: categoryEdge?.node?.name?.trim() as string + }; + }) }); } else { console.log(`No category to create`); } } + + if (!skipDatabase) { + const allCategory = await db.category.findUnique({ where: { slug: 'all' } }); + if (!allCategory) { + await db.category.create({ + data: { + name: 'All', + slug: 'all' + } + }); + } + } } catch (err) { logging.error(err, 'Error fetching Marathon categories'); } @@ -242,23 +271,15 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetched ${collections.length} collections`); if (!skipDatabase && collections && collections.length > 0) { - const ids = collections - .map((collectionEdge) => collectionEdge?.node?.id as string) // Casting because we're filtering right after - .filter((x) => !!x); - const existingCollections = await db.collection.findMany({ select: { externalId: true, + slug: true, thumbnailUrl: true, translations: { where: { locale: defaultSyncLocale }, select: { id: true } } - }, - where: { - externalId: { - in: ids - } } }); @@ -279,6 +300,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { whitelistedSlugs.includes(collectionEdge.node.slug.trim()) ); + const collectionsWithSlug = existingCollections.filter((col) => + collectionsToCreate.some((collectionEdge) => collectionEdge?.node?.slug === col.slug) + ); + for (let i = 0; i < collectionsToUpdate.length; i++) { const collectionEdge = collectionsToUpdate[i]; const id = collectionEdge?.node?.id; @@ -287,19 +312,19 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (!currentCollection || !currentCollection.externalId) continue; console.log( - `Updating collection #${i + 1} id: ${currentCollection.externalId} of ${collectionsToUpdate.length}` + `Updating collection id: ${currentCollection.externalId} #${i + 1} of ${collectionsToUpdate.length}` ); const translationIds = currentCollection.translations.map((x) => x.id); + const thumbnailUrl = collectionEdge?.node?.image?.fullpath; + + if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); await db.collection.update({ where: { externalId: currentCollection.externalId }, data: { slug: collectionEdge?.node?.slug?.trim(), - thumbnailUrl: makeThumbnailUrlAndQueue( - collectionEdge?.node?.image?.fullpath, - currentCollection.thumbnailUrl - ), + thumbnailUrl, hasPegs: collectionEdge?.node?.hasPegs || undefined, isComingSoon: collectionEdge?.node?.isComingSoon || undefined, translations: @@ -325,19 +350,27 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await db.collection.createMany({ data: collectionsToCreate .filter((collectionEdge) => collectionEdge?.node?.id && collectionEdge?.node?.slug) - .map((collectionEdge) => ({ - // Casting because we're sure, since there's a filter right above - externalId: collectionEdge?.node?.id as string, - slug: collectionEdge?.node?.slug?.trim() as string, - thumbnailUrl: makeThumbnailUrlAndQueue( - collectionEdge?.node?.image?.fullpath?.trim(), - `images/collection/${collectionEdge?.node?.slug?.trim()}${path.extname( - collectionEdge?.node?.image?.fullpath?.trim() || '' - )}}` - ), - hasPegs: collectionEdge?.node?.hasPegs || false, - isComingSoon: collectionEdge?.node?.isComingSoon || false - })) + .map((collectionEdge) => { + let slug = collectionEdge?.node?.slug?.trim() as string; + + const sameSlugCollections = collectionsWithSlug.filter((col) => col.slug === slug); + if (sameSlugCollections?.length > 0) { + slug = `${slug}-${sameSlugCollections.length}`; + } + + const thumbnailUrl = collectionEdge?.node?.image?.fullpath?.trim(); + + if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); + + return { + // Casting because we're sure, since there's a filter right above + externalId: collectionEdge?.node?.id as string, + slug, + thumbnailUrl, + hasPegs: collectionEdge?.node?.hasPegs || false, + isComingSoon: collectionEdge?.node?.isComingSoon || false + }; + }) }); console.log(`Fetching recently created ${collectionsToCreate.length} collections`); @@ -395,23 +428,15 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetched ${drawerTypes.length} drawer types`); if (!skipDatabase && drawerTypes && drawerTypes.length > 0) { - const ids = drawerTypes - .map((drawerTypeEdge) => drawerTypeEdge?.node?.id as string) // Casting because we filter right after - .filter((x) => !!x); - const existingDrawerTypes = await db.type.findMany({ select: { externalId: true, + slug: true, thumbnailUrl: true, translations: { where: { locale: defaultSyncLocale }, select: { id: true } } - }, - where: { - externalId: { - in: ids - } } }); @@ -432,6 +457,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { whitelistedSlugs.includes(drawerTypeEdge.node.slug.trim()) ); + const typesWithSlug = existingDrawerTypes.filter((type) => + drawerTypesToCreate.some((typeEdge) => typeEdge?.node?.slug === type.slug) + ); + for (let i = 0; i < drawerTypesToUpdate.length; i++) { const drawerTypeEdge = drawerTypesToUpdate[i]; const id = drawerTypeEdge?.node?.id; @@ -440,19 +469,20 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (!currentDrawerType || !currentDrawerType.externalId) continue; console.log( - `Updating drawer type #${i + 1} id: ${currentDrawerType.externalId} of ${drawerTypesToUpdate.length}` + `Updating drawer type id: ${currentDrawerType.externalId} #${i + 1} of ${drawerTypesToUpdate.length}` ); const translationIds = currentDrawerType.translations.map((x) => x.id); + const thumbnailUrl = drawerTypeEdge?.node?.image?.fullpath; + + if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); + await db.type.update({ where: { externalId: currentDrawerType.externalId }, data: { slug: drawerTypeEdge?.node?.slug?.trim(), - thumbnailUrl: makeThumbnailUrlAndQueue( - drawerTypeEdge?.node?.image?.fullpath, - currentDrawerType.thumbnailUrl - ), + thumbnailUrl, hasPegs: drawerTypeEdge?.node?.hasPegs || undefined, // isComingSoon: drawerTypeEdge?.node?.isComingSoon || undefined, @@ -478,19 +508,27 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await db.type.createMany({ data: drawerTypesToCreate .filter((drawerTypeEdge) => drawerTypeEdge?.node?.id && drawerTypeEdge?.node?.slug) - .map((drawerTypeEdge) => ({ - // Casting because we're filtering right above - externalId: drawerTypeEdge?.node?.id as string, - slug: drawerTypeEdge?.node?.slug?.trim() as string, - thumbnailUrl: makeThumbnailUrlAndQueue( - drawerTypeEdge?.node?.image?.fullpath?.trim(), - `images/type/${drawerTypeEdge?.node?.slug?.trim()}${path.extname( - drawerTypeEdge?.node?.image?.fullpath?.trim() || '' - )}` - ), - hasPegs: drawerTypeEdge?.node?.hasPegs || false - // isComingSoon: drawerTypeEdge?.node?.isComingSoon || false - })) + .map((drawerTypeEdge) => { + let slug = drawerTypeEdge?.node?.slug?.trim() as string; + + const sameSlugTypes = typesWithSlug.filter((type) => type.slug === slug); + if (sameSlugTypes?.length > 0) { + slug = `${slug}-${sameSlugTypes.length}`; + } + + const thumbnailUrl = drawerTypeEdge?.node?.image?.fullpath?.trim(); + + if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); + + return { + // Casting because we're filtering right above + externalId: drawerTypeEdge?.node?.id as string, + slug, + thumbnailUrl, + hasPegs: drawerTypeEdge?.node?.hasPegs || false + // isComingSoon: drawerTypeEdge?.node?.isComingSoon || false + }; + }) }); console.log(`Fetching recently created ${drawerTypesToCreate.length} drawer types`); @@ -546,23 +584,15 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Fetched ${finishes.length} finishes`); if (!skipDatabase && finishes && finishes.length > 0) { - const ids = finishes - .map((finishEdge) => finishEdge?.node?.id as string) // Casting since we're filtering right after - .filter((x) => !!x); - const existingFinishes = await db.finish.findMany({ select: { externalId: true, + slug: true, thumbnailUrl: true, translations: { where: { locale: defaultSyncLocale }, select: { id: true } } - }, - where: { - externalId: { - in: ids - } } }); @@ -583,6 +613,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { whitelistedSlugs.includes(finishEdge.node.slug.trim()) ); + const finishesWithSlug = existingFinishes.filter((fin) => + finishesToCreate.some((finishEdge) => finishEdge?.node?.slug === fin.slug) + ); + for (let i = 0; i < finishesToUpdate.length; i++) { const finishEdge = finishesToUpdate[i]; const id = finishEdge?.node?.id; @@ -590,15 +624,19 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const currentFinish = existingFinishes.find((x) => x.externalId === id); if (!currentFinish || !currentFinish.externalId) continue; - console.log(`Updating finish #${i + 1} id: ${id} of ${finishesToUpdate.length}`); + console.log(`Updating finish id: ${id} #${i + 1} of ${finishesToUpdate.length}`); const translationIds = currentFinish.translations.map((x) => x.id); + const thumbnailUrl = finishEdge?.node?.image?.fullpath; + + if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); + await db.finish.update({ where: { externalId: currentFinish.externalId }, data: { slug: finishEdge?.node?.slug?.trim(), - thumbnailUrl: makeThumbnailUrlAndQueue(finishEdge?.node?.image?.fullpath, currentFinish.thumbnailUrl), + thumbnailUrl, translations: translationIds && translationIds.length > 0 ? { @@ -623,17 +661,25 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter( (finishEdge) => finishEdge?.node?.id && finishEdge?.node?.slug && finishEdge?.node?.image?.fullpath ) - .map((finishEdge) => ({ - // Casing since we're filtering right above - externalId: finishEdge?.node?.id?.trim() as string, - slug: finishEdge?.node?.slug?.trim() as string, - thumbnailUrl: makeThumbnailUrlAndQueue( - finishEdge?.node?.image?.fullpath?.trim(), - `images/finish/${finishEdge?.node?.slug?.trim()}${path.extname( - finishEdge?.node?.image?.fullpath?.trim() || '' - )}` - ) - })) + .map((finishEdge) => { + let slug = finishEdge?.node?.slug?.trim() as string; + + const sameSlugFinishes = finishesWithSlug.filter((fin) => fin.slug === slug); + if (sameSlugFinishes?.length > 0) { + slug = `${slug}-${sameSlugFinishes.length}`; + } + + const thumbnailUrl = finishEdge?.node?.image?.fullpath?.trim(); + + if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); + + return { + // Casing since we're filtering right above + externalId: finishEdge?.node?.id?.trim() as string, + slug, + thumbnailUrl + }; + }) }); console.log(`Fetching recently created ${finishesToCreate.length} finishes`); @@ -641,10 +687,21 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { where: { externalId: { in: finishesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, + slug: true, externalId: true } }); + const collectionsForFinishes = await db.collection.findMany({ + where: { + slug: { + in: seed.collectionFinishes + .filter((colFin) => recentlyCreatedFinishes.some((dbFin) => dbFin.slug === colFin.finish)) + .map((x) => x.collection) + } + } + }); + console.log(`Batch creating ${recentlyCreatedFinishes.length} finish translations`); await db.finishTranslations.createMany({ data: recentlyCreatedFinishes.map((dbFinish) => { @@ -659,6 +716,19 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }; }) }); + + console.log(`Batch creating ${recentlyCreatedFinishes.length} collection finishes`); + await db.collectionFinishes.createMany({ + data: recentlyCreatedFinishes.map((dbFinish) => { + const collectionFinish = seed.collectionFinishes.find((x) => x.finish === dbFinish.slug); + const collection = collectionsForFinishes.find((x) => x.slug === collectionFinish?.collection); + + return { + finishId: dbFinish.id, + collectionId: collection?.id || -1 + }; + }) + }); } else { console.log(`No finish to create`); } @@ -671,22 +741,134 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.timeEnd('finish'); }; + const syncSlides = async (skipDatabase?: boolean) => { + if (!db) { + throw new Error('db dependency was not provided'); + } + + console.log('Syncing slides'); + console.time('slides'); + console.log('Fetching slides'); + + try { + // const { data } = await marathonApollo.query({ + // query: GET_SP_FINISH_LISTING, + // fetchPolicy: 'no-cache' + // }); + const data = seed.slides; + + const slides = data; + console.log(`Fetched ${slides.length} slides`); + + if (!skipDatabase && slides && slides.length > 0) { + for (let i = 0; i < slides.length; i++) { + const slideEdge = slides[i]; + + console.log(`Upserting slide #${i + 1} of ${slides.length}`); + + const supplierSlug = helpers.slugify(slideEdge.supplier).toLowerCase(); + const slideSlug = helpers + .slugify(`${slideEdge.supplier}-${slideEdge.product}-${slideEdge.collection}`) + .toLowerCase(); + + let existingSlide = await db.slide.findUnique({ where: { slug: slideSlug } }); + + if (!existingSlide) { + if (!skipDatabase) { + existingSlide = await db.slide.create({ + data: { + slug: slideSlug, + formula: slideEdge.formula, + product: slideEdge.product, + supplier: { + connectOrCreate: { + where: { + slug: supplierSlug + }, + create: { + name: slideEdge.supplier, + slug: supplierSlug, + thumbnailUrl: seed.supplierLogos.find((y) => y.supplier === supplierSlug)?.supplierImgURL + } + } + }, + collection: { + connect: { + slug: slideEdge.collection + } + } + } + }); + } + } else if (false) { + if (!skipDatabase) { + // Commented for now since we're using seed so data would never be updated + // existingSlide = await db.slide.update({ + // where: { slug: slideSlug }, + // data: { + // formula: slideEdge.formula, + // product: slideEdge.product, + // supplier: { + // connectOrCreate: { + // where: { + // slug: supplierSlug + // }, + // create: { + // name: slideEdge.supplier, + // slug: supplierSlug, + // thumbnailUrl: seed.supplierLogos.find((y) => y.supplier === supplierSlug)?.supplierImgURL + // } + // } + // }, + // collection: { + // connect: { + // slug: slideEdge.collection + // } + // } + // } + // }); + // await db.slideDepth.deleteMany({ where: { slideId: existingSlide.id } }); + } + } + + const depths = slideEdge.depth; + if (!skipDatabase && existingSlide && depths?.length > 0) { + await db.slideDepth.createMany({ + data: depths.map(({ roundedValue, value }) => ({ + display: `${roundedValue}mm`, + depth: toNumber(value), + slideId: existingSlide?.id || -1 + })) + }); + } + } + } + } catch (err) { + logging.error(err, 'Error fetching Marathon slides'); + } + + console.log('Finished syncing slides'); + console.timeEnd('slides'); + }; + const upsertProductModule = async ( module: ModuleRules, - skipDatabase?: boolean - ): Promise<'created' | 'updated' | 'failed'> => { + skipDatabase?: boolean, + originalMarathonProductJson?: MarathonModule + // eslint-disable-next-line @typescript-eslint/ban-types + ): Promise<'created' | 'updated' | (string & {})> => { if (!db) { throw new Error('db dependency was not provided'); } - if (!module.externalId) return 'failed'; + if (!module.externalId) return `Module ${module.partNumber} has no externalId`; - let status: 'created' | 'updated' | 'failed' = 'created'; + let status = 'created'; console.log(`Upserting module ${module.partNumber} ${module.externalId}`); - const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); + //const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + //makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); const existingProduct = await db.module.findUnique({ where: { @@ -694,188 +876,206 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }); - const { finish, collection, drawerTypes, categories, otherFinishes, ...moduleRest } = module; + const partNumberProduct = await db.module.findMany({ + where: { + partNumber: { startsWith: module.partNumber } + } + }); + + // Removes unwanted data out of "module" + const { finish, collection, drawerTypes, categories, otherFinishes, extensions, dimensions, ...moduleRest } = + module; + + let { partNumber } = module; + + if (!existingProduct && partNumberProduct?.length > 0) { + partNumber = `${partNumber}-${partNumberProduct.length}`; + } let resultModule: Module | undefined; //! Use interactive transactions with caution. Keeping transactions open for a long time hurts database performance and can even cause deadlocks. //! Try to avoid performing network requests and executing slow queries inside, get in and out as quick as possible! - await db.$transaction(async (db) => { - if (!existingProduct) { - if (!skipDatabase) { - resultModule = await db.module.create({ - data: { - ...moduleRest, - rules: module, - finish: { - connect: { - externalId: finish.externalId - } - }, - collection: { - connect: { - externalId: collection.externalId - } - }, - defaultLeftExtension: module.extensions?.left - ? { - connect: { - partNumber: module.extensions.left - } - } - : undefined, - defaultRightExtension: module.extensions?.right - ? { - connect: { - partNumber: module.extensions.right - } + // await db.$transaction(async (db) => { + if (!existingProduct) { + if (!skipDatabase) { + resultModule = await db.module.create({ + data: { + ...moduleRest, + partNumber, + rules: module, + originalMarathonProductJson, + finish: { + connect: { + externalId: finish.externalId + } + }, + collection: { + connect: { + externalId: collection.externalId + } + }, + defaultLeftExtension: extensions?.left + ? { + connect: { + partNumber: extensions.left } - : undefined, - attachmentToAppend: module.rules?.queue?.append - ? { - connect: { - partNumber: module.rules.queue.append - } + } + : undefined, + defaultRightExtension: extensions?.right + ? { + connect: { + partNumber: extensions.right } - : undefined - } - }); - } - } else { - status = 'updated'; - if (!skipDatabase) { - const rules = existingProduct.rules ? mergeRules(module, existingProduct.rules as ModuleRules) : module; - - await db.module.update({ - where: { id: existingProduct.id }, - data: { - ...moduleRest, - rules, - finish: { - connect: { - externalId: finish.externalId } - }, - collection: { - connect: { - externalId: collection.externalId + : undefined, + attachmentToAppend: module.rules?.queue?.append + ? { + connect: { + partNumber: module.rules.queue.append + } } - }, - defaultLeftExtension: module.extensions?.left - ? { - connect: { - partNumber: module.extensions.left - } + : undefined + } + }); + } + } else { + status = 'updated'; + if (!skipDatabase) { + const rules = existingProduct.rules ? mergeRules(module, existingProduct.rules as ModuleRules) : module; + + await db.module.update({ + where: { id: existingProduct.id }, + data: { + ...moduleRest, + partNumber, + rules, + originalMarathonProductJson, + finish: { + connect: { + externalId: finish.externalId + } + }, + collection: { + connect: { + externalId: collection.externalId + } + }, + defaultLeftExtension: extensions?.left + ? { + connect: { + partNumber: extensions.left } - : undefined, - defaultRightExtension: module.extensions?.right - ? { - connect: { - partNumber: module.extensions.right - } + } + : undefined, + defaultRightExtension: extensions?.right + ? { + connect: { + partNumber: extensions.right } - : undefined, - attachmentToAppend: module.rules?.queue?.append - ? { - connect: { - partNumber: module.rules.queue.append - } + } + : undefined, + attachmentToAppend: module.rules?.queue?.append + ? { + connect: { + partNumber: module.rules.queue.append } - : undefined - } - }); + } + : undefined + } + }); - // If this module already exists, it already has all the relations, so delete them for them to be created - // This is needed in case they completely changed the values here - await db.moduleType.deleteMany({ where: { module: { id: existingProduct.id } } }); - await db.moduleCategory.deleteMany({ where: { module: { id: existingProduct.id } } }); - await db.moduleAttachments.deleteMany({ where: { module: { id: existingProduct.id } } }); - } + // If this module already exists, it already has all the relations, so delete them for them to be created + // This is needed in case they completely changed the values here + await db.moduleType.deleteMany({ where: { module: { id: existingProduct.id } } }); + await db.moduleCategory.deleteMany({ where: { module: { id: existingProduct.id } } }); + await db.moduleAttachments.deleteMany({ where: { module: { id: existingProduct.id } } }); } + } - if (resultModule) { - if (!skipDatabase && drawerTypes && drawerTypes.length > 0) { - const existingTypes = await db.type.findMany({ - where: { - externalId: { - // Casting since we're filtering right before - in: drawerTypes.filter((x) => !!x).map((x) => x?.externalId as string) - } - }, - select: { - id: true, - externalId: true + if (resultModule) { + if (!skipDatabase && drawerTypes && drawerTypes.length > 0) { + const existingTypes = await db.type.findMany({ + where: { + externalId: { + // Casting since we're filtering right before + in: drawerTypes.filter((x) => !!x).map((x) => x?.externalId as string) } - }); + }, + select: { + id: true, + externalId: true + } + }); - await db.moduleType.createMany({ - data: drawerTypes.map((type) => ({ - moduleId: resultModule?.id || -1, - typeId: existingTypes.find((x) => x.externalId === type?.externalId)?.id || -1 - })) - }); - } + await db.moduleType.createMany({ + data: drawerTypes.map((type) => ({ + moduleId: resultModule?.id || -1, + typeId: existingTypes.find((x) => x.externalId === type?.externalId)?.id || -1 + })) + }); + } - if (!skipDatabase && categories && categories.length > 0) { - const existingCategories = await db.category.findMany({ - where: { - OR: [ - { - externalId: { - // Casting since we're filtering right before - in: categories.filter((x) => !!x).map((x) => x?.externalId as string) - } - }, - { - slug: 'all' + if (!skipDatabase && categories && categories.length > 0) { + const existingCategories = await db.category.findMany({ + where: { + OR: [ + { + externalId: { + // Casting since we're filtering right before + in: categories.filter((x) => !!x).map((x) => x?.externalId as string) } - ] - }, - select: { - id: true, - externalId: true, - slug: true - } - }); + }, + { + slug: 'all' + } + ] + }, + select: { + id: true, + externalId: true, + slug: true + } + }); - await db.moduleCategory.createMany({ - // Manually add the all category - data: [...categories, { slug: 'all', externalId: undefined }].map((category) => ({ - moduleId: resultModule?.id || -1, - categoryId: - existingCategories.find( - // Whether it's the correct category or all category - (x) => x.externalId === category?.externalId || (category?.slug === 'all' && x.slug === 'all') - )?.id || -1 - })) - }); - } + await db.moduleCategory.createMany({ + // Manually add the all category + data: [...categories, { slug: 'all', externalId: undefined }].map((category) => ({ + moduleId: resultModule?.id || -1, + categoryId: + existingCategories.find( + // Whether it's the correct category or all category + (x) => x.externalId === category?.externalId || (category?.slug === 'all' && x.slug === 'all') + )?.id || -1 + })) + }); + } - const moduleAttachments = module.rules?.queue?.modules; + const moduleAttachments = module.rules?.queue?.modules; - if (!skipDatabase && moduleAttachments && moduleAttachments.length > 0) { - const existingModules = await db.module.findMany({ - where: { - partNumber: { in: moduleAttachments.map((x) => x) } - }, - select: { - id: true, - partNumber: true - } - }); + if (!skipDatabase && moduleAttachments && moduleAttachments.length > 0) { + const existingModules = await db.module.findMany({ + where: { + partNumber: { in: moduleAttachments.map((x) => x) } + }, + select: { + id: true, + partNumber: true + } + }); - await db.moduleAttachments.createMany({ - // Manually add the all category - data: moduleAttachments.map((modAttachment) => ({ - moduleId: resultModule?.id || -1, - attachmentId: existingModules.find((x) => x.partNumber === modAttachment)?.id || -1 - })) - }); - } + await db.moduleAttachments.createMany({ + // Manually add the all category + data: moduleAttachments.map((modAttachment) => ({ + moduleId: resultModule?.id || -1, + attachmentId: existingModules.find((x) => x.partNumber === modAttachment)?.id || -1 + })) + }); } - }); - // TODO: sync thumbnail image + if (resultModule.thumbnailUrl) storageSyncQueue.push(resultModule.thumbnailUrl); + } + // }); return status; }; @@ -908,7 +1108,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); console.log('Fetching products'); - const ignoredModules: string[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const ignoredModules: any[] = []; // console.log(print(GET_PRODUCT_LISTING)); while (pageIndex >= 0) { console.log(`Asking for ${productsPerPage} products on page ${pageIndex + 1}`); @@ -927,31 +1128,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (products && products.length > 0) { console.log(`Product page ${pageIndex + 1}, fetched ${products.length} products`); - // Small debug method to output every product - // products.forEach((product, i) => { - // const module = product?.node; - // const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - - // makeFile(dir, path.join(`marathon/${module?.partNumber || i}.json`), module || {}); - - // const rules = mergeRules(module); - // makeFile(dir, path.join(`jsons/${module?.partNumber || i}.json`), rules || {}); - - // const queueAppend = makeQueueAppendRulesFromMarathonModule(module); - - // if (queueAppend?.append) - // makeFile( - // dir, - // path.join(`jsons/${queueAppend.append.partNumber || `append-${i}`}.json`), - // queueAppend.append - // ); - - // if (queueAppend?.queueModules && queueAppend.queueModules.length > 0) - // queueAppend.queueModules.forEach((queueModule, j) => - // makeFile(dir, path.join(`jsons/${queueModule.partNumber || `queuemodule-${j}`}.json`), queueModule) - // ); - // }); - products = products.filter( // Where it DOESN'T exist in the database (productEdge) => { @@ -970,13 +1146,12 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // And filter const hasExpectedCondition = - finishId !== undefined && // Is there finish id(should have) - collectionId !== undefined && // Is there collection id(should have) + finishId && // Is there finish id(should have) + collectionId && // Is there collection id(should have) module?.id; // Does it have an id itself (all of them should have id) if (!hasExpectedCondition) { - // Casting because we know it should exist, since there's a condition for that in hasExpectedCondition - ignoredModules.push(module?.id as string); + ignoredModules.push({ finishId, collectionId, module }); } return hasExpectedCondition; @@ -985,7 +1160,29 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const parsedProducts = products .filter((x) => !!x?.node) - .flatMap((productEdge) => makeRulesFromMarathonModule(productEdge?.node as MarathonModule)); // Casting since we filtered it previously + .flatMap((productEdge) => { + try { + // Casting since we filtered it previously + return { + ...makeRulesFromMarathonModule(productEdge?.node as MarathonModule), + originalMarathonProductJson: productEdge + }; + } catch (err) { + logging.error( + err, + `Could not parse and convert module ${productEdge?.node?.partNumber} ${productEdge?.node?.id}` + ); + return undefined; + } + }) + .filter((x) => !!x) + // We do this just for casting, since we know it won't be undefined due to the filter above + .map( + (x) => + x as ReturnType & { originalMarathonProductJson: MarathonModule } + ); + + console.log(`Going to upsert ${parsedProducts.length} products`); let created = 0; let updated = 0; @@ -993,75 +1190,112 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { for (let i = 0; i < parsedProducts.length; i++) { const product = parsedProducts[i]; - if (product.attachments?.append) { - const appendStatus = await upsertProductModule(product.attachments.append, skipDatabase); - switch (appendStatus) { - case 'created': + console.log(`Product ${i + 1} out of ${parsedProducts.length}`); + + try { + if (product.attachments?.append) { + const appendStatus = await upsertProductModule( + product.attachments.append, + skipDatabase, + product.originalMarathonProductJson + ); + if (appendStatus === 'created') { created++; - case 'updated': + } else if (appendStatus === 'updated') { updated++; - case 'failed': - throw makeError('Could not upsert attachment append', 'cannotUpsertAppend'); + } else { + throw makeError(`Could not upsert attachment append: ${appendStatus}`, 'cannotUpsertAppend'); + } } - } - if (product.attachments?.queueModules && product.attachments.queueModules.length > 0) { - for (let j = 0; j < product.attachments.queueModules.length; j++) { - const queueModule = product.attachments.queueModules[j]; - const queueStatus = await upsertProductModule(queueModule, skipDatabase); - switch (queueStatus) { - case 'created': + if (product.attachments?.queueModules && product.attachments.queueModules.length > 0) { + for (let j = 0; j < product.attachments.queueModules.length; j++) { + const queueModule = product.attachments.queueModules[j]; + const queueStatus = await upsertProductModule( + queueModule, + skipDatabase, + product.originalMarathonProductJson + ); + if (queueStatus === 'created') { created++; - case 'updated': + } else if (queueStatus === 'updated') { updated++; - case 'failed': - throw makeError('Could not upsert attachment queue moduke', 'cannotUpsertQueueModule'); + } else { + throw makeError( + `Could not upsert attachment queue module: ${queueStatus}`, + 'cannotUpsertQueueModule' + ); + } } } - } - if (product.extensions?.left) { - const extensionStatus = await upsertProductModule(product.extensions.left, skipDatabase); - switch (extensionStatus) { - case 'created': + if (product.extensions?.left) { + const extensionStatus = await upsertProductModule( + product.extensions.left, + skipDatabase, + product.originalMarathonProductJson + ); + if (extensionStatus === 'created') { created++; - case 'updated': + } else if (extensionStatus === 'updated') { updated++; - case 'failed': - throw makeError('Could not upsert left extension', 'cannotUpsertLeftExtension'); + } else { + throw makeError(`Could not upsert left extension: ${extensionStatus}`, 'cannotUpsertLeftExtension'); + } } - } - if (product.extensions?.right) { - const extensionStatus = await upsertProductModule(product.extensions.right, skipDatabase); - switch (extensionStatus) { - case 'created': + if (product.extensions?.right) { + const extensionStatus = await upsertProductModule( + product.extensions.right, + skipDatabase, + product.originalMarathonProductJson + ); + if (extensionStatus === 'created') { created++; - case 'updated': + } else if (extensionStatus === 'updated') { updated++; - case 'failed': - throw makeError('Could not upsert right extension', 'cannotUpsertRightExtension'); + } else { + throw makeError(`Could not upsert right extension: ${extensionStatus}`, 'cannotUpsertRightExtension'); + } } - } - if (product.alternative) { - const extensionStatus = await upsertProductModule(product.alternative, skipDatabase); - switch (extensionStatus) { - case 'created': + if (product.alternative) { + const alternativeStatus = await upsertProductModule( + product.alternative, + skipDatabase, + product.originalMarathonProductJson + ); + if (alternativeStatus === 'created') { created++; - case 'updated': + } else if (alternativeStatus === 'updated') { updated++; - case 'failed': - throw makeError('Could not upsert alternative version', 'cannotUpsertAlternative'); + } else { + throw makeError( + `Could not upsert alternative version: ${alternativeStatus}`, + 'cannotUpsertAlternative' + ); + } } - } - const productStatus = await upsertProductModule(product.module, skipDatabase); - switch (productStatus) { - case 'created': + const productStatus = await upsertProductModule( + product.module, + skipDatabase, + product.originalMarathonProductJson + ); + if (productStatus === 'created') { created++; - case 'updated': + } else if (productStatus === 'updated') { updated++; + } else { + throw makeError(`Could not upsert main product: ${productStatus}`, 'cannotUpsertMainProduct'); + } + } catch (err) { + logging.error( + err, + `Error upserting product ${i + 1} out of ${parsedProducts.length}. ${product.module.partNumber} ${ + product.module.externalId + }` + ); } } @@ -1091,9 +1325,14 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } if (ignoredModules && ignoredModules.length > 0) { + try { + const dir = path.join(__dirname, `./output`, '../../../../../marathon-logs'); + makeFile(dir, path.join(`ignored-modules.json`), { ignoredModules }); + } catch { + // Do nothing + } logging.warn( - `Sync: ${ignoredModules.length} modules that were not created due to not following required criteria`, - { ignoredModules } + `Sync: ${ignoredModules.length} modules that were not created due to not following required criteria` ); } } catch (err) { @@ -1111,6 +1350,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await syncCollection(skipDatabase); await syncDrawerType(skipDatabase); await syncFinish(skipDatabase); + await syncSlides(skipDatabase); // Always leave products for last!! await syncProduct(skipDatabase); diff --git a/src/services/marathon/parsing/constants.ts b/src/services/marathon/parsing/constants.ts index 9a1e2f2..8efc8c8 100644 --- a/src/services/marathon/parsing/constants.ts +++ b/src/services/marathon/parsing/constants.ts @@ -22,6 +22,7 @@ export const FEATURE_NAMES = { LEFT_EXTENSION_ATTRIBUTE: 'Left Extensions for Imprint CT', RULES_ATTRIBUTE: 'Rules for Options', EXT_PART: 'ext_part', + EXT_ID: 'ext_id', EXT_FINISHES: 'ext_finishes', ROTATION: 'rotation', ANGLE: 'angle', diff --git a/src/services/marathon/parsing/parseRules.ts b/src/services/marathon/parsing/parseRules.ts index ef5c054..47e868c 100644 --- a/src/services/marathon/parsing/parseRules.ts +++ b/src/services/marathon/parsing/parseRules.ts @@ -1,4 +1,5 @@ import deepmerge from 'deepmerge'; +import { helpers } from 'faker'; import { isEqual } from 'lodash'; import path from 'path'; import { CsFeatureInput } from '../../../generated/graphql'; @@ -6,6 +7,7 @@ import { NexusGenObjects } from '../../../generated/nexus'; import { convertMmToInFormatted } from '../../../utils/conversion'; import { makeError } from '../../../utils/exception'; import { replaceExtension } from '../../../utils/file'; +import logging from '../../../utils/logging'; import { FeatureList, FEATURE_NAMES, MarathonModule, ModuleRules } from './constants'; import { getBooleanSelectFeature, @@ -216,19 +218,23 @@ export const makeRulesFromMarathonModule = ( alternative?: ModuleRules; } => { const externalId = marathonModule.id; - if (!externalId) throw makeError('Cannot create rule without id', 'ruleMergeMissingId'); + if (!externalId) throw makeError(`Module ${marathonModule.partNumber} does not have an id`, 'ruleMergeMissingId'); const marathonFinish = marathonModule.spFinish; if (!marathonFinish || !marathonFinish.id) - throw makeError('Cannot create rule without finish', 'ruleMergeMissingFinish'); + throw makeError( + `Module ${marathonModule.partNumber} ${externalId} does not have a finish`, + 'ruleMergeMissingFinish' + ); const marathonCollection = marathonModule.spCollection; if (!marathonCollection || !marathonCollection.id) - throw makeError('Cannot create rule without collection', 'ruleMergeMissingCollection'); + throw makeError( + `Module ${marathonModule.partNumber} ${externalId} does not have a collection`, + 'ruleMergeMissingCollection' + ); const marathonDrawerTypes = marathonModule.spDrawerTypes; - if (!marathonDrawerTypes || marathonDrawerTypes.length <= 0 || marathonDrawerTypes.some((x) => !x?.id)) - throw makeError('Cannot create rule without finish', 'ruleMergeMissingDrawerType'); const specialAttributes = [ FEATURE_NAMES.LEFT_EXTENSION_ATTRIBUTE, @@ -274,10 +280,7 @@ export const makeRulesFromMarathonModule = ( externalId: externalId, description: marathonModule.shortDescription || marathonModule.titleDescription || marathonModule.itemDescription || undefined, - thumbnailUrl: makeThumbnailUrlAndQueue( - sourceThumbnail, - `images/module/${marathonModule.partNumber?.trim()}${path.extname(sourceThumbnail || '')}` - ), + thumbnailUrl: sourceThumbnail, // bundleUrl: module?.bundlePath?.fullpath?.trim() || undefined, isSubmodule: marathonModule.isSubmodule || false, hasPegs: marathonModule.hasPegs || false, @@ -288,7 +291,7 @@ export const makeRulesFromMarathonModule = ( : true, alwaysDisplay: marathonModule.alwaysDisplay || false, isEdge: marathonModule.isEdge || false, - isImprintExtension: false, // False in this case, we'll manually set to true on the method regarding extensions + isExtension: false, // False in this case, we'll manually set to true on the method regarding extensions finish: { externalId: marathonFinish.id, slug: marathonFinish.slug || undefined @@ -297,7 +300,7 @@ export const makeRulesFromMarathonModule = ( externalId: marathonCollection.id, slug: marathonCollection.slug || undefined }, - drawerTypes: marathonDrawerTypes.map((marathonDrawerType) => ({ + drawerTypes: marathonDrawerTypes?.map((marathonDrawerType) => ({ // Casting because we check previously right at the beginning and throw if it doesn't have an id externalId: marathonDrawerType?.id as string, slug: marathonDrawerType?.slug @@ -322,6 +325,9 @@ export const makeRulesFromMarathonModule = ( alternative: marathonModule.alternative ? { ...module, + externalId: `${module.externalId}-alternative-${ + marathonModule.alternative.partNumber || `${module.partNumber}-B` + }`, hasPegs: marathonModule.alternative.hasPegs || false, partNumber: marathonModule.alternative.partNumber || `${module.partNumber}-B` } @@ -329,27 +335,6 @@ export const makeRulesFromMarathonModule = ( }; }; -export const makeThumbnailUrlAndQueue = (sourcePath?: string | null, currentPath?: string | null) => { - let thumbnailUrl: string | undefined; - - if (sourcePath?.trim() && currentPath?.trim()) { - thumbnailUrl = replaceExtension(currentPath, sourcePath); - let originalPath = thumbnailUrl; - - // If the extension were changed, the paths are now different. So store the previous original path so the image can be deleted - if (currentPath !== originalPath) originalPath = currentPath; - - // TODO: Fix storage sync - // storageSyncQueue.push({ - // sourcePath, - // originalPath, - // destinationPath: thumbnailUrl - // }); - } - - return thumbnailUrl; -}; - export const makeAttachments = ( parent: ModuleRules, marathonModule: MarathonModule @@ -363,9 +348,13 @@ export const makeAttachments = ( const queueModules = marathonModule?.configuratorAttributes // Of all configurator attributes ?.filter((attribute) => attribute?.description?.includes(FEATURE_NAMES.QUEUE_MODULES_ATTRIBUTE)) // We grab only the ones that includes the queue modules description ?.map((queueModuleAttribute) => { - const partNumber = getInputFeature(queueModuleAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) - ); + const partNumber = + getInputFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || + `${parent.externalId}-queue-module`; + + const externalId = + getInputFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || + helpers.slugify(partNumber).toLowerCase() + '-queue-module'; const otherFinishes = getMultiSelectFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) @@ -380,7 +369,7 @@ export const makeAttachments = ( return { ...parent, partNumber, - externalId: `${parent.externalId}-queue-${partNumber}`, + externalId, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: undefined, // Not really used for queue modules isSubmodule: true, // Not really used for queue modules but they are kinda like submodules @@ -388,7 +377,7 @@ export const makeAttachments = ( shouldHideBasedOnWidth: false, // Not used for queue modules alwaysDisplay: false, // Queue modules don't show up as pegboard(this isn't even used) isEdge: false, // Queue modules are never edge - isImprintExtension: false, + isExtension: false, isMat: false, otherFinishes, @@ -408,9 +397,14 @@ export const makeAttachments = ( // Bail if there's none if (!queueModules || queueModules.length <= 0 || !appendModulesAttribute) return undefined; - const partNumber = getInputFeature(appendModulesAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) - ); + const partNumber = + getInputFeature(appendModulesAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || + parent.rules?.queue?.append || + `${parent.externalId}-append`; + + const externalId = + getInputFeature(appendModulesAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || + helpers.slugify(partNumber).toLowerCase() + '-append'; const otherFinishes = getMultiSelectFeature(appendModulesAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) @@ -425,8 +419,8 @@ export const makeAttachments = ( return { append: { ...parent, - partNumber: partNumber || `${parent.externalId}-append`, - externalId: `${parent.externalId}-append-${partNumber}`, + partNumber, + externalId, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: undefined, // Not really used for queue modules isSubmodule: true, // Not really used for queue modules but they are kinda like submodules @@ -434,7 +428,7 @@ export const makeAttachments = ( shouldHideBasedOnWidth: false, // Not used for queue modules alwaysDisplay: false, // Queue modules don't show up as pegboard(this isn't even used) isEdge: false, // Queue modules are never edge - isImprintExtension: false, + isExtension: false, isMat: false, otherFinishes, @@ -452,7 +446,7 @@ export const makeExtensions = ( ): | { left: ModuleRules; - right: ModuleRules; + right?: ModuleRules; } | undefined => { // First, we grab the left and right extensions, using the expected attributes descriptions @@ -469,10 +463,15 @@ export const makeExtensions = ( if (!leftExtensionAttribute || !rightExtensionAttribute) return undefined; // Then, for some reason, extensions finishes are not arrays but a single input like everything else 🤷 so lets grab them too + const leftPartNumber = + getInputFeature(leftExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || + parent.extensions?.left || + `${parent.externalId}-left-extension`; + + const leftExternalId = + getInputFeature(leftExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || + helpers.slugify(leftPartNumber).toLowerCase(); - const leftPartNumber = getInputFeature(leftExtensionAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) - ); const leftFinish = getInputFeature(leftExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) ); @@ -481,9 +480,14 @@ export const makeExtensions = ( const leftRules = makeRulesObjectFromAttribute(leftExtensionAttribute?.features); const leftThumbnail = getInputFeature(leftExtensionAttribute?.features, FEATURE_NAMES.PRODUCT_PICTURE_FULL_PATH); - const rightPartNumber = getInputFeature(rightExtensionAttribute?.features, (feature) => - feature?.name?.endsWith(FEATURE_NAMES.EXT_PART) - ); + const rightPartNumber = + getInputFeature(rightExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || + parent.extensions?.right || + `${parent.externalId}-right-extension`; + + const rightExternalId = + getInputFeature(rightExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || + helpers.slugify(rightPartNumber).toLowerCase(); const rightFinish = getInputFeature(rightExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) ); @@ -496,44 +500,43 @@ export const makeExtensions = ( // And convert them to the format we expect left: { ...parent, - partNumber: leftPartNumber || `${parent.externalId}-left-extension`, - externalId: `${parent.externalId}-left-extension-${leftPartNumber}`, + extensions: undefined, + partNumber: leftPartNumber, + externalId: leftExternalId, description: undefined, // They don't provide descriptions for nested modules - thumbnailUrl: makeThumbnailUrlAndQueue( - leftThumbnail, - `images/module/${marathonModule.partNumber?.trim()}${path.extname(leftThumbnail || '')}` - ), + thumbnailUrl: leftThumbnail, isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules hasPegs: false, // Not used for extensions shouldHideBasedOnWidth: false, // Not used for extensions alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) isEdge: false, // extensions are never edge, - isImprintExtension: true, + isExtension: true, isMat: false, otherFinishes: leftOtherFinishes, dimensions: leftDimensions, rules: leftRules }, - right: { - ...parent, - partNumber: rightPartNumber || `${parent.externalId}-right-extension-${rightPartNumber}`, - externalId: `${parent.externalId}-right-extension-${rightPartNumber}`, - description: undefined, // They don't provide descriptions for nested modules - thumbnailUrl: makeThumbnailUrlAndQueue( - rightThumbnail, - `images/module/${marathonModule.partNumber?.trim()}${path.extname(rightThumbnail || '')}` - ), - isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules - hasPegs: false, // Not used for extensions - shouldHideBasedOnWidth: false, // Not used for extensions - alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) - isEdge: false, // extensions are never edge, - isImprintExtension: true, - isMat: false, - otherFinishes: rightOtherFinishes, - dimensions: rightDimensions, - rules: rightRules - } + right: + rightPartNumber !== leftPartNumber + ? { + ...parent, + extensions: undefined, + partNumber: rightPartNumber, + externalId: rightExternalId, + description: undefined, // They don't provide descriptions for nested modules + thumbnailUrl: rightThumbnail, + isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules + hasPegs: false, // Not used for extensions + shouldHideBasedOnWidth: false, // Not used for extensions + alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) + isEdge: false, // extensions are never edge, + isExtension: true, + isMat: false, + otherFinishes: rightOtherFinishes, + dimensions: rightDimensions, + rules: rightRules + } + : undefined }; }; From 0358583f1a1688221fb0331b1e27e664f303ba47 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Tue, 26 Apr 2022 14:02:06 -0300 Subject: [PATCH 07/13] feat: adds owner external id and virtual product --- graphql.schema.json | 4 +- .../migration.sql | 2 + .../migration.sql | 2 + prisma/schema.prisma | 2 + src/generated/graphql.ts | 17 ++-- src/generated/nexus-prisma.d.ts | 26 ++++--- src/generated/nexus.d.ts | 78 +++++++++++++++++++ src/generated/schema.graphql | 70 +++++++++++++++++ src/routes/v1/sync.ts | 11 +++ src/schema/moduleRules.ts | 2 + src/services/marathon/index.ts | 45 ++++++++++- src/services/marathon/parsing/parseRules.ts | 55 ++++++++++--- src/services/marathon/queries.ts | 9 +++ 13 files changed, 288 insertions(+), 35 deletions(-) create mode 100644 prisma/migrations/20220426145400_add_virtual_product_column/migration.sql create mode 100644 prisma/migrations/20220426150934_adds_owner_external_id/migration.sql diff --git a/graphql.schema.json b/graphql.schema.json index 20847dd..cfaa56c 100644 --- a/graphql.schema.json +++ b/graphql.schema.json @@ -5326,7 +5326,7 @@ }, { "kind": "OBJECT", - "name": "element_metadata_item_6262fc65db489", + "name": "element_metadata_item_626823308bb9e", "description": null, "fields": [ { @@ -6328,7 +6328,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "element_metadata_item_6262fc65db489", + "name": "element_metadata_item_626823308bb9e", "ofType": null } }, diff --git a/prisma/migrations/20220426145400_add_virtual_product_column/migration.sql b/prisma/migrations/20220426145400_add_virtual_product_column/migration.sql new file mode 100644 index 0000000..21e044d --- /dev/null +++ b/prisma/migrations/20220426145400_add_virtual_product_column/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `Module` ADD COLUMN `isVirtualProduct` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20220426150934_adds_owner_external_id/migration.sql b/prisma/migrations/20220426150934_adds_owner_external_id/migration.sql new file mode 100644 index 0000000..67478b6 --- /dev/null +++ b/prisma/migrations/20220426150934_adds_owner_external_id/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `Module` ADD COLUMN `ownerExternalId` VARCHAR(191); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 21b98ac..59eed0f 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -105,6 +105,7 @@ model Module { id Int @id @default(autoincrement()) partNumber String @unique externalId String? @unique + ownerExternalId String? description String? thumbnailUrl String? @db.VarChar(255) bundleUrl String? @db.VarChar(255) @@ -113,6 +114,7 @@ model Module { isMat Boolean @default(false) isExtension Boolean @default(false) shouldHideBasedOnWidth Boolean @default(false) + isVirtualProduct Boolean @default(false) createdAt DateTime @default(now()) @db.DateTime(0) updatedAt DateTime @default(now()) @db.DateTime(0) alwaysDisplay Boolean @default(false) diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index 6d9b8ce..ca6db80 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -569,8 +569,8 @@ export type Element = { id?: Maybe; }; -export type Element_Metadata_Item_6262fc65db489 = { - __typename?: 'element_metadata_item_6262fc65db489'; +export type Element_Metadata_Item_626823308bb9e = { + __typename?: 'element_metadata_item_626823308bb9e'; name?: Maybe; value?: Maybe; }; @@ -698,7 +698,7 @@ export type Object_Product_BundlePath = Asset; export type Object_Product_Finishes = { __typename?: 'object_product_finishes'; element?: Maybe; - metadata?: Maybe>>; + metadata?: Maybe>>; }; export type Object_Product_Options = Object_Product; @@ -954,7 +954,7 @@ export type SpFinishFragment = { __typename?: 'object_spFinish', id?: string | n export type ConfiguratorAttributesFragment = { __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null }; -export type ProductFragment = { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_6262fc65db489', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null }; +export type ProductFragment = { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_626823308bb9e', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null }; export type GetSpCategoryListingQueryVariables = Exact<{ [key: string]: never; }>; @@ -1003,9 +1003,16 @@ export type GetProductListingQueryVariables = Exact<{ }>; -export type GetProductListingQuery = { __typename?: 'Query', getProductListing?: { __typename?: 'ProductConnection', edges?: Array<{ __typename?: 'ProductEdge', node?: { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_6262fc65db489', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null } | null } | null> | null } | null }; +export type GetProductListingQuery = { __typename?: 'Query', getProductListing?: { __typename?: 'ProductConnection', edges?: Array<{ __typename?: 'ProductEdge', node?: { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_626823308bb9e', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null } | null } | null> | null } | null }; export type GetProductStatusQueryVariables = Exact<{ [key: string]: never; }>; export type GetProductStatusQuery = { __typename?: 'Query', getProductListing?: { __typename?: 'ProductConnection', edges?: Array<{ __typename?: 'ProductEdge', node?: { __typename?: 'object_product', id?: string | null } | null } | null> | null } | null }; + +export type GetProductQueryVariables = Exact<{ + id?: InputMaybe; +}>; + + +export type GetProductQuery = { __typename?: 'Query', getProduct?: { __typename?: 'object_product', id?: string | null, childrenSortBy?: string | null, classname?: string | null, creationDate?: number | null, hasPegs?: boolean | null, index?: number | null, isMat?: boolean | null, isSubmodule?: boolean | null, itemDescription?: string | null, modificationDate?: number | null, p21Uid?: string | null, shortDescription?: string | null, shouldHideBasedOnWidth?: boolean | null, titleDescription?: string | null, isEdge?: boolean | null, alwaysDisplay?: boolean | null, partNumber?: string | null, alternative?: { __typename?: 'object_alternative', id?: string | null, hasPegs?: boolean | null, partNumber?: string | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null } | null, productPictures?: Array<{ __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null> | null, properties?: Array<{ __typename?: 'property_checkbox', name?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'property_object', name?: string | null, type?: string | null, object?: { __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, itemId?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null } | { __typename?: 'property_select' } | { __typename?: 'property_text', name?: string | null, type?: string | null, text?: string | null } | null> | null, tags?: Array<{ __typename?: 'element_tag', id?: string | null, name?: string | null, path?: string | null } | null> | null, spCategories?: Array<{ __typename?: 'object_spCategory', id?: string | null, name?: string | null, slug?: string | null } | null> | null, spCollection?: { __typename?: 'object_spCollection', id?: string | null, hasPegs?: boolean | null, slug?: string | null, subtitle?: string | null, description?: string | null, name?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null, spDrawerTypes?: Array<{ __typename?: 'object_spDrawerTypes', id?: string | null, name?: string | null, slug?: string | null, hasPegs?: boolean | null, description?: string | null, image?: { __typename?: 'asset', id?: string | null, fullpath?: string | null } | null } | null> | null, spFinish?: { __typename?: 'object_spFinish', id?: string | null, description?: string | null, name?: string | null, slug?: string | null, isComingSoon?: boolean | null, image?: { __typename?: 'asset', id?: string | null, filename?: string | null, fullpath?: string | null } | null } | null, bundlePath?: { __typename?: 'asset', id?: string | null, creationDate?: number | null, fullpath?: string | null, mimetype?: string | null, modificationDate?: number | null, type?: string | null, filesize?: number | null, metadata?: Array<{ __typename?: 'asset_metadata_item', name?: string | null, type?: string | null, data?: string | null, language?: string | null } | null> | null } | null, finishes?: Array<{ __typename?: 'object_product_finishes', element?: { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null, metadata?: Array<{ __typename?: 'element_metadata_item_626823308bb9e', name?: string | null } | null> | null } | null> | null, configuratorAttributes?: Array<{ __typename?: 'csGroup', id?: number | null, description?: string | null, features?: Array<{ __typename?: 'csFeatureBooleanSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCalculatedValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, calculatedvalue?: string | null } | { __typename?: 'csFeatureCheckbox', id?: number | null, name?: string | null, description?: string | null, type?: string | null, checked?: boolean | null } | { __typename?: 'csFeatureCountry', id?: number | null, name?: string | null, description?: string | null, type?: string | null, country?: string | null } | { __typename?: 'csFeatureCountryMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, countries?: Array | null } | { __typename?: 'csFeatureDate', id?: number | null, name?: string | null, description?: string | null, type?: string | null, date?: string | null } | { __typename?: 'csFeatureDatetime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, datetime?: string | null } | { __typename?: 'csFeatureInput', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureInputQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, inputquantityvalue?: { __typename?: 'InputQuantityValue', value?: string | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureLanguage', id?: number | null, name?: string | null, description?: string | null, type?: string | null, language?: string | null } | { __typename?: 'csFeatureLangugeMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, languages?: Array | null } | { __typename?: 'csFeatureMultiselect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selections?: Array | null } | { __typename?: 'csFeatureNumeric', id?: number | null, name?: string | null, description?: string | null, type?: string | null, number?: string | null } | { __typename?: 'csFeatureQuantityValue', id?: number | null, name?: string | null, description?: string | null, type?: string | null, quantityvalue?: { __typename?: 'QuantityValue', value?: number | null, unit?: { __typename?: 'QuantityValueUnit', id?: string | null, abbreviation?: string | null, longname?: string | null } | null } | null } | { __typename?: 'csFeatureRgbaColor', id?: number | null, name?: string | null, description?: string | null, type?: string | null, color?: string | null } | { __typename?: 'csFeatureSelect', id?: number | null, name?: string | null, description?: string | null, type?: string | null, selection?: string | null } | { __typename?: 'csFeatureSlider', id?: number | null, name?: string | null, description?: string | null, type?: string | null, slidervalue?: string | null } | { __typename?: 'csFeatureTextarea', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | { __typename?: 'csFeatureTime', id?: number | null, name?: string | null, description?: string | null, type?: string | null, time?: string | null } | { __typename?: 'csFeatureWysiwyg', id?: number | null, name?: string | null, description?: string | null, type?: string | null, text?: string | null } | null> | null } | null> | null, options?: Array<{ __typename?: 'object_product', id?: string | null, partNumber?: string | null } | null> | null, children?: Array<{ __typename?: 'object_alternative' } | { __typename?: 'object_product', id?: string | null, partNumber?: string | null } | { __typename?: 'object_spCategory' } | { __typename?: 'object_spCollection' } | { __typename?: 'object_spDrawerTypes' } | { __typename?: 'object_spFinish' } | null> | null } | null }; diff --git a/src/generated/nexus-prisma.d.ts b/src/generated/nexus-prisma.d.ts index fc1607b..a1810f2 100644 --- a/src/generated/nexus-prisma.d.ts +++ b/src/generated/nexus-prisma.d.ts @@ -75,8 +75,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'moduleId' | 'attachmentId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } projects: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'type' | 'collectionId' | 'collection' | 'finishId' | 'finish' | 'slideId' | 'slide' | 'slideDepthId' | 'slideDepth' | 'userId' | 'user' | 'projectModules' | 'lists' @@ -138,8 +138,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'collectionId' | 'finishId' | 'slideId' | 'slideDepthId' | 'userId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } collectionFinishes: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'collectionId' | 'collection' | 'finishId' | 'finish' @@ -166,8 +166,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'collectionId' | 'finishId' | 'slideId' | 'slideDepthId' | 'userId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } collectionFinishes: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'collectionId' | 'collection' | 'finishId' | 'finish' @@ -193,16 +193,16 @@ interface NexusPrismaInputs { ordering: 'id' | 'moduleId' | 'categoryId' } defaultLeftExtensionParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } defaultRightExtensionParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } attachmentToAppendParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' - ordering: 'id' | 'partNumber' | 'externalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } moduleAttachments: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'moduleId' | 'module' | 'attachmentId' | 'attachment' @@ -536,6 +536,7 @@ interface NexusPrismaOutputs { id: 'Int' partNumber: 'String' externalId: 'String' + ownerExternalId: 'String' description: 'String' thumbnailUrl: 'String' bundleUrl: 'String' @@ -544,6 +545,7 @@ interface NexusPrismaOutputs { isMat: 'Boolean' isExtension: 'Boolean' shouldHideBasedOnWidth: 'Boolean' + isVirtualProduct: 'Boolean' createdAt: 'DateTime' updatedAt: 'DateTime' alwaysDisplay: 'Boolean' diff --git a/src/generated/nexus.d.ts b/src/generated/nexus.d.ts index 71bc403..05655f3 100644 --- a/src/generated/nexus.d.ts +++ b/src/generated/nexus.d.ts @@ -1307,7 +1307,9 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1336,7 +1338,9 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1365,7 +1369,9 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1394,7 +1400,9 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1423,7 +1431,9 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1591,11 +1601,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1622,11 +1634,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1653,11 +1667,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1684,11 +1700,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1715,11 +1733,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1746,11 +1766,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1777,11 +1799,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1808,11 +1832,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1840,10 +1866,12 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1871,10 +1899,12 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1902,10 +1932,12 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1933,11 +1965,13 @@ export interface NexusGenInputs { isExtension?: boolean | null; // Boolean isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -1968,7 +2002,9 @@ export interface NexusGenInputs { isExtension?: NexusGenEnums['SortOrder'] | null; // SortOrder isMat?: NexusGenEnums['SortOrder'] | null; // SortOrder isSubmodule?: NexusGenEnums['SortOrder'] | null; // SortOrder + isVirtualProduct?: NexusGenEnums['SortOrder'] | null; // SortOrder originalMarathonProductJson?: NexusGenEnums['SortOrder'] | null; // SortOrder + ownerExternalId?: NexusGenEnums['SortOrder'] | null; // SortOrder partNumber?: NexusGenEnums['SortOrder'] | null; // SortOrder rules?: NexusGenEnums['SortOrder'] | null; // SortOrder shouldHideBasedOnWidth?: NexusGenEnums['SortOrder'] | null; // SortOrder @@ -1996,7 +2032,9 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFilter'] | null; // BoolFilter isMat?: NexusGenInputs['BoolFilter'] | null; // BoolFilter isSubmodule?: NexusGenInputs['BoolFilter'] | null; // BoolFilter + isVirtualProduct?: NexusGenInputs['BoolFilter'] | null; // BoolFilter originalMarathonProductJson?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter + ownerExternalId?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter partNumber?: NexusGenInputs['StringFilter'] | null; // StringFilter rules?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter shouldHideBasedOnWidth?: NexusGenInputs['BoolFilter'] | null; // BoolFilter @@ -2169,7 +2207,9 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2377,11 +2417,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2408,11 +2450,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2439,11 +2483,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2470,11 +2516,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2501,11 +2549,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2532,11 +2582,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2563,11 +2615,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2594,11 +2648,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2626,10 +2682,12 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2657,10 +2715,12 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2688,10 +2748,12 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2719,11 +2781,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2824,11 +2888,13 @@ export interface NexusGenInputs { isExtension?: NexusGenInputs['BoolFilter'] | null; // BoolFilter isMat?: NexusGenInputs['BoolFilter'] | null; // BoolFilter isSubmodule?: NexusGenInputs['BoolFilter'] | null; // BoolFilter + isVirtualProduct?: NexusGenInputs['BoolFilter'] | null; // BoolFilter moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsListRelationFilter'] | null; // ModuleAttachmentsListRelationFilter moduleAttachments?: NexusGenInputs['ModuleAttachmentsListRelationFilter'] | null; // ModuleAttachmentsListRelationFilter moduleCategories?: NexusGenInputs['ModuleCategoryListRelationFilter'] | null; // ModuleCategoryListRelationFilter moduleType?: NexusGenInputs['ModuleTypeListRelationFilter'] | null; // ModuleTypeListRelationFilter originalMarathonProductJson?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter + ownerExternalId?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter partNumber?: NexusGenInputs['StringFilter'] | null; // StringFilter projectModules?: NexusGenInputs['ProjectModuleListRelationFilter'] | null; // ProjectModuleListRelationFilter rules?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter @@ -4897,7 +4963,9 @@ export interface NexusGenObjects { isExtension: boolean; // Boolean! isMat: boolean; // Boolean! isSubmodule: boolean; // Boolean! + isVirtualProduct: boolean; // Boolean! originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + ownerExternalId?: string | null; // String partNumber: string; // String! shouldHideBasedOnWidth: boolean; // Boolean! updatedAt: NexusGenScalars['DateTime']; // DateTime! @@ -4968,7 +5036,9 @@ export interface NexusGenObjects { isExtension: boolean; // Boolean! isMat?: boolean | null; // Boolean isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean otherFinishes?: string[] | null; // [String!] + ownerExternalId?: string | null; // String partNumber: string; // String! rules?: NexusGenRootTypes['ModuleRulesMetadata'] | null; // ModuleRulesMetadata shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -5212,10 +5282,12 @@ export interface NexusGenFieldTypes { isExtension: boolean; // Boolean! isMat: boolean; // Boolean! isSubmodule: boolean; // Boolean! + isVirtualProduct: boolean; // Boolean! moduleAttachedTo: NexusGenRootTypes['ModuleAttachments'][]; // [ModuleAttachments!]! moduleAttachments: NexusGenRootTypes['ModuleAttachments'][]; // [ModuleAttachments!]! moduleType: NexusGenRootTypes['ModuleType'][]; // [ModuleType!]! originalMarathonProductJson: NexusGenScalars['Json'] | null; // Json + ownerExternalId: string | null; // String partNumber: string; // String! projectModules: NexusGenRootTypes['ProjectModule'][]; // [ProjectModule!]! rules: NexusGenRootTypes['ModuleRules'] | null; // ModuleRules @@ -5294,7 +5366,9 @@ export interface NexusGenFieldTypes { isExtension: boolean; // Boolean! isMat: boolean | null; // Boolean isSubmodule: boolean | null; // Boolean + isVirtualProduct: boolean | null; // Boolean otherFinishes: string[] | null; // [String!] + ownerExternalId: string | null; // String partNumber: string; // String! rules: NexusGenRootTypes['ModuleRulesMetadata'] | null; // ModuleRulesMetadata shouldHideBasedOnWidth: boolean | null; // Boolean @@ -5603,10 +5677,12 @@ export interface NexusGenFieldTypeNames { isExtension: 'Boolean'; isMat: 'Boolean'; isSubmodule: 'Boolean'; + isVirtualProduct: 'Boolean'; moduleAttachedTo: 'ModuleAttachments'; moduleAttachments: 'ModuleAttachments'; moduleType: 'ModuleType'; originalMarathonProductJson: 'Json'; + ownerExternalId: 'String'; partNumber: 'String'; projectModules: 'ProjectModule'; rules: 'ModuleRules'; @@ -5685,7 +5761,9 @@ export interface NexusGenFieldTypeNames { isExtension: 'Boolean'; isMat: 'Boolean'; isSubmodule: 'Boolean'; + isVirtualProduct: 'Boolean'; otherFinishes: 'String'; + ownerExternalId: 'String'; partNumber: 'String'; rules: 'ModuleRulesMetadata'; shouldHideBasedOnWidth: 'Boolean'; diff --git a/src/generated/schema.graphql b/src/generated/schema.graphql index abb5ec1..629ffc4 100644 --- a/src/generated/schema.graphql +++ b/src/generated/schema.graphql @@ -1174,10 +1174,12 @@ type Module { isExtension: Boolean! isMat: Boolean! isSubmodule: Boolean! + isVirtualProduct: Boolean! moduleAttachedTo(cursor: ModuleAttachmentsWhereUniqueInput, skip: Int, take: Int): [ModuleAttachments!]! moduleAttachments(cursor: ModuleAttachmentsWhereUniqueInput, skip: Int, take: Int): [ModuleAttachments!]! moduleType(cursor: ModuleTypeWhereUniqueInput, skip: Int, take: Int): [ModuleType!]! originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules( cursor: ProjectModuleWhereUniqueInput @@ -1489,7 +1491,9 @@ input ModuleCreateManyAttachmentToAppendInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1518,7 +1522,9 @@ input ModuleCreateManyCollectionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1547,7 +1553,9 @@ input ModuleCreateManyDefaultLeftExtensionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1576,7 +1584,9 @@ input ModuleCreateManyDefaultRightExtensionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1605,7 +1615,9 @@ input ModuleCreateManyFinishInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -1773,11 +1785,13 @@ input ModuleCreateWithoutAttachmentToAppendInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1804,11 +1818,13 @@ input ModuleCreateWithoutAttachmentToAppendParentsInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1835,11 +1851,13 @@ input ModuleCreateWithoutCollectionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1866,11 +1884,13 @@ input ModuleCreateWithoutDefaultLeftExtensionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1897,11 +1917,13 @@ input ModuleCreateWithoutDefaultLeftExtensionParentsInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1928,11 +1950,13 @@ input ModuleCreateWithoutDefaultRightExtensionInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1959,11 +1983,13 @@ input ModuleCreateWithoutDefaultRightExtensionParentsInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1990,11 +2016,13 @@ input ModuleCreateWithoutFinishInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2022,10 +2050,12 @@ input ModuleCreateWithoutModuleAttachedToInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2053,10 +2083,12 @@ input ModuleCreateWithoutModuleAttachmentsInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2084,10 +2116,12 @@ input ModuleCreateWithoutModuleTypeInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2115,11 +2149,13 @@ input ModuleCreateWithoutProjectModulesInput { isExtension: Boolean isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: String partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -2177,7 +2213,9 @@ input ModuleOrderByInput { isExtension: SortOrder isMat: SortOrder isSubmodule: SortOrder + isVirtualProduct: SortOrder originalMarathonProductJson: SortOrder + ownerExternalId: SortOrder partNumber: SortOrder rules: SortOrder shouldHideBasedOnWidth: SortOrder @@ -2209,11 +2247,13 @@ type ModuleRules { isExtension: Boolean! isMat: Boolean isSubmodule: Boolean + isVirtualProduct: Boolean """ The equivalent of same module but on other finishes """ otherFinishes: [String!] + ownerExternalId: String """ The module part number, probably equivalent to the module id @@ -2292,7 +2332,9 @@ input ModuleScalarWhereInput { isExtension: BoolFilter isMat: BoolFilter isSubmodule: BoolFilter + isVirtualProduct: BoolFilter originalMarathonProductJson: JsonNullableFilter + ownerExternalId: StringNullableFilter partNumber: StringFilter rules: JsonNullableFilter shouldHideBasedOnWidth: BoolFilter @@ -2478,7 +2520,9 @@ input ModuleUpdateManyMutationInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput rules: Json shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput @@ -2686,11 +2730,13 @@ input ModuleUpdateWithoutAttachmentToAppendInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2717,11 +2763,13 @@ input ModuleUpdateWithoutAttachmentToAppendParentsInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2748,11 +2796,13 @@ input ModuleUpdateWithoutCollectionInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2779,11 +2829,13 @@ input ModuleUpdateWithoutDefaultLeftExtensionInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2810,11 +2862,13 @@ input ModuleUpdateWithoutDefaultLeftExtensionParentsInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2841,11 +2895,13 @@ input ModuleUpdateWithoutDefaultRightExtensionInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2872,11 +2928,13 @@ input ModuleUpdateWithoutDefaultRightExtensionParentsInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2903,11 +2961,13 @@ input ModuleUpdateWithoutFinishInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2935,10 +2995,12 @@ input ModuleUpdateWithoutModuleAttachedToInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2966,10 +3028,12 @@ input ModuleUpdateWithoutModuleAttachmentsInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2997,10 +3061,12 @@ input ModuleUpdateWithoutModuleTypeInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -3028,11 +3094,13 @@ input ModuleUpdateWithoutProjectModulesInput { isExtension: BoolFieldUpdateOperationsInput isMat: BoolFieldUpdateOperationsInput isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput originalMarathonProductJson: Json + ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput rules: Json shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput @@ -3133,11 +3201,13 @@ input ModuleWhereInput { isExtension: BoolFilter isMat: BoolFilter isSubmodule: BoolFilter + isVirtualProduct: BoolFilter moduleAttachedTo: ModuleAttachmentsListRelationFilter moduleAttachments: ModuleAttachmentsListRelationFilter moduleCategories: ModuleCategoryListRelationFilter moduleType: ModuleTypeListRelationFilter originalMarathonProductJson: JsonNullableFilter + ownerExternalId: StringNullableFilter partNumber: StringFilter projectModules: ProjectModuleListRelationFilter rules: JsonNullableFilter diff --git a/src/routes/v1/sync.ts b/src/routes/v1/sync.ts index fae2174..74e74a9 100644 --- a/src/routes/v1/sync.ts +++ b/src/routes/v1/sync.ts @@ -16,4 +16,15 @@ router.get('/', async (req, res) => { } }); +router.get('/parse/:id', async (req, res) => { + const { SYNC_AUTH } = env; + if (SYNC_AUTH && req.query.auth === SYNC_AUTH && req.params.id) { + // Do not await, fire and forget + const data = await marathonService({ db: getDb() }).fetchSingleProduct(req.params.id); + res.json(data); + } else { + res.status(401).json({ error: 'unauthorized' }); + } +}); + export default router; diff --git a/src/schema/moduleRules.ts b/src/schema/moduleRules.ts index f51317d..2fa9ce4 100644 --- a/src/schema/moduleRules.ts +++ b/src/schema/moduleRules.ts @@ -163,6 +163,8 @@ export const ModuleRules = objectType({ t.boolean('shouldHideBasedOnWidth'); t.boolean('alwaysDisplay'); t.boolean('isEdge'); + t.boolean('isVirtualProduct'); + t.string('ownerExternalId'); t.nonNull.boolean('isExtension'); diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index cecb34d..7b2b51f 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -15,7 +15,9 @@ import { GetSpCategoryListingQuery, GetSpCollectionListingQuery, GetSpDrawerTypesListingQuery, - GetSpFinishListingQuery + GetSpFinishListingQuery, + GetProductQuery, + GetProductQueryVariables } from '../../generated/graphql'; import { makeError } from '../../utils/exception'; import { makeFile } from '../../utils/file'; @@ -25,6 +27,7 @@ import { projectService } from '../project'; import { MarathonModule, ModuleRules } from './parsing/constants'; import { makeRulesFromMarathonModule, mergeRules } from './parsing/parseRules'; import { + GET_PRODUCT, GET_PRODUCT_LISTING, GET_SP_CATEGORY_LISTING, GET_SP_COLLECTION_LISTING, @@ -116,6 +119,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Upload new image await fileUpload.uploadFileToStorage(file.data, imagePath); + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (err: any) { if (err?.response?.status && err.response.status === 404) { imagesNotFound.push(new URL(imagePath, MARATHON_MEDIA_URI).toString()); @@ -1441,14 +1445,18 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter((x) => x.projectModule.module.externalId) .forEach((cartItem) => { items.push({ - oid: cartItem.projectModule.module.externalId as string, + oid: + (cartItem.projectModule.module.ownerExternalId as string) || + (cartItem.projectModule.module.externalId as string), quantity: cartItem.quantity }); if (cartItem.children && cartItem.children.length > 0) { cartItem.children.forEach((cartItem) => { items.push({ - oid: cartItem.projectModule.module.externalId as string, + oid: + (cartItem.projectModule.module.ownerExternalId as string) || + (cartItem.projectModule.module.externalId as string), quantity: cartItem.quantity }); }); @@ -1513,10 +1521,39 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { })) as AxiosResponse<{ user_id: number; user_token: string }>; }; + const fetchSingleProduct = async (id: string) => { + if (!db) { + throw new Error('db dependency was not provided'); + } + + const { data } = await marathonApollo.query({ + query: GET_PRODUCT, + fetchPolicy: 'no-cache', + variables: { + id: Number(id) + } + }); + + if (data?.getProduct) { + const parsedRules = makeRulesFromMarathonModule(data.getProduct); + + const currentDbEntry = await db.module.findUnique({ where: { externalId: id } }); + + return { + original: data.getProduct, + parsedRules, + currentDbEntry + }; + } else { + throw makeError(`Module with id ${id} does not exist`, 'moduleDoesNotExist', 404); + } + }; + return { marathonApollo, syncData, createList, - login + login, + fetchSingleProduct }; }; diff --git a/src/services/marathon/parsing/parseRules.ts b/src/services/marathon/parsing/parseRules.ts index 47e868c..7a8f3dc 100644 --- a/src/services/marathon/parsing/parseRules.ts +++ b/src/services/marathon/parsing/parseRules.ts @@ -328,6 +328,8 @@ export const makeRulesFromMarathonModule = ( externalId: `${module.externalId}-alternative-${ marathonModule.alternative.partNumber || `${module.partNumber}-B` }`, + isVirtualProduct: true, + ownerExternalId: module.externalId, hasPegs: marathonModule.alternative.hasPegs || false, partNumber: marathonModule.alternative.partNumber || `${module.partNumber}-B` } @@ -352,9 +354,16 @@ export const makeAttachments = ( getInputFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || `${parent.externalId}-queue-module`; - const externalId = - getInputFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || - helpers.slugify(partNumber).toLowerCase() + '-queue-module'; + let isVirtualProduct = false; + + let externalId = getInputFeature(queueModuleAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_ID) + ); + + if (!externalId) { + externalId = helpers.slugify(partNumber).toLowerCase() + '-queue-module'; + isVirtualProduct = true; + } const otherFinishes = getMultiSelectFeature(queueModuleAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) @@ -370,6 +379,7 @@ export const makeAttachments = ( ...parent, partNumber, externalId, + isVirtualProduct, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: undefined, // Not really used for queue modules isSubmodule: true, // Not really used for queue modules but they are kinda like submodules @@ -402,9 +412,16 @@ export const makeAttachments = ( parent.rules?.queue?.append || `${parent.externalId}-append`; - const externalId = - getInputFeature(appendModulesAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || - helpers.slugify(partNumber).toLowerCase() + '-append'; + let isVirtualProduct = false; + + let externalId = getInputFeature(appendModulesAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_ID) + ); + + if (!externalId) { + externalId = helpers.slugify(partNumber).toLowerCase() + '-append'; + isVirtualProduct = true; + } const otherFinishes = getMultiSelectFeature(appendModulesAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) @@ -421,6 +438,7 @@ export const makeAttachments = ( ...parent, partNumber, externalId, + isVirtualProduct, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: undefined, // Not really used for queue modules isSubmodule: true, // Not really used for queue modules but they are kinda like submodules @@ -467,10 +485,16 @@ export const makeExtensions = ( getInputFeature(leftExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || parent.extensions?.left || `${parent.externalId}-left-extension`; + let leftVirtualProduct = false; - const leftExternalId = - getInputFeature(leftExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || - helpers.slugify(leftPartNumber).toLowerCase(); + let leftExternalId = getInputFeature(leftExtensionAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_ID) + ); + + if (!leftExternalId) { + leftExternalId = helpers.slugify(leftPartNumber).toLowerCase(); + leftVirtualProduct = true; + } const leftFinish = getInputFeature(leftExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) @@ -484,10 +508,15 @@ export const makeExtensions = ( getInputFeature(rightExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_PART)) || parent.extensions?.right || `${parent.externalId}-right-extension`; + let rightVirtualProduct = false; - const rightExternalId = - getInputFeature(rightExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_ID)) || - helpers.slugify(rightPartNumber).toLowerCase(); + let rightExternalId = getInputFeature(rightExtensionAttribute?.features, (feature) => + feature?.name?.endsWith(FEATURE_NAMES.EXT_ID) + ); + if (!rightExternalId) { + rightExternalId = helpers.slugify(rightPartNumber).toLowerCase(); + rightVirtualProduct = true; + } const rightFinish = getInputFeature(rightExtensionAttribute?.features, (feature) => feature?.name?.endsWith(FEATURE_NAMES.EXT_FINISHES) ); @@ -503,6 +532,7 @@ export const makeExtensions = ( extensions: undefined, partNumber: leftPartNumber, externalId: leftExternalId, + isVirtualProduct: leftVirtualProduct, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: leftThumbnail, isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules @@ -523,6 +553,7 @@ export const makeExtensions = ( extensions: undefined, partNumber: rightPartNumber, externalId: rightExternalId, + isVirtualProduct: rightVirtualProduct, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: rightThumbnail, isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules diff --git a/src/services/marathon/queries.ts b/src/services/marathon/queries.ts index ffda481..1bb28c4 100644 --- a/src/services/marathon/queries.ts +++ b/src/services/marathon/queries.ts @@ -132,3 +132,12 @@ export const GET_PRODUCT_STATUS = gql` } } `; + +export const GET_PRODUCT = gql` + query GetProduct($id: Int) { + getProduct(id: $id) { + ...Product + } + } + ${SP_PRODUCT_FRAGMENT} +`; From e5c171241e87ed18145e84a5bfbd5daa5ec5f548 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Wed, 27 Apr 2022 11:08:33 -0300 Subject: [PATCH 08/13] fix: fixes inconsistencies with sync --- package-lock.json | 14 +-- package.json | 1 + prisma/seedValues/seed.json | 162 +++++++++++++++++++++++++++------ src/services/fileUpload.ts | 5 +- src/services/marathon/index.ts | 136 ++++++++++++++++++--------- 5 files changed, 239 insertions(+), 79 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e479af..6d33af4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5460,16 +5460,16 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", - "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==" + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" }, "mime-types": { - "version": "2.1.34", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", - "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "requires": { - "mime-db": "1.51.0" + "mime-db": "1.52.0" } }, "mimic-fn": { diff --git a/package.json b/package.json index 96df5f2..d420692 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "graphql-middleware": "^6.0.10", "graphql-shield": "^7.5.0", "lodash": "^4.17.21", + "mime-types": "^2.1.35", "multer": "^1.4.3", "multer-s3": "^2.10.0", "nanoid": "^3.2.0", diff --git a/prisma/seedValues/seed.json b/prisma/seedValues/seed.json index 0f38e46..209ddad 100644 --- a/prisma/seedValues/seed.json +++ b/prisma/seedValues/seed.json @@ -3321,7 +3321,7 @@ }, { "partNumber": "04-AU-USHAPE-BIR-B", - "bundlePath": "modules/autograph/04-au-ushape-xxx-b/04-au-ushape-bir-b/module", + "bundlePath": "modules/autograph/04-au-xxx-ushape-b/04-au-bir-ushape-b/module", "finish": "birch", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-USHAPE-BIR-B\",\r\n \"finishes\": [\r\n \"04-AU-USHAPE-WAL-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 55,\r\n \"inches\": \"2\\\" 5/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true,\r\n \"options\": [\r\n \"04-AU-ACCENT-SW-141\",\r\n \"04-AU-ACCENT-MB-141\",\r\n \"04-AU-ACCENT-SD-141\",\r\n \"04-AU-ACCENT-AN-141\",\r\n \"04-AU-ACCENT-AU79-141\"\r\n ]\r\n }\r\n}", @@ -3329,13 +3329,41 @@ "hasPegs": false, "isMat": false, "isExtension": false, - "imageUrl": "images/module/autograph/04-AU-USHAPE-xxx-B/04-AU-USHAPE-BIR-B/04-AU-USHAPE-BIR-B.jpg", - "genericName": "04-AU-USHAPE-xxx-B", + "imageUrl": "images/module/autograph/04-AU-xxx-USHAPE-B/04-AU-BIR-USHAPE-B/04-AU-BIR-USHAPE-B.jpg", + "genericName": "04-AU-xxx-USHAPE-B", + "categorySlug": ["all", "accessories"] + }, + { + "partNumber": "04-AU-BIR-USHAPE-B", + "bundlePath": "modules/autograph/04-au-xxx-ushape-b/04-au-bir-ushape-b/module", + "finish": "birch", + "collection": "autograph", + "rules": "{\r\n \"partNumber\": \"04-AU-USHAPE-BIR-B\",\r\n \"finishes\": [\r\n \"04-AU-USHAPE-WAL-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 55,\r\n \"inches\": \"2\\\" 5/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true,\r\n \"options\": [\r\n \"04-AU-ACCENT-SW-141\",\r\n \"04-AU-ACCENT-MB-141\",\r\n \"04-AU-ACCENT-SD-141\",\r\n \"04-AU-ACCENT-AN-141\",\r\n \"04-AU-ACCENT-AU79-141\"\r\n ]\r\n }\r\n}", + "isSubmodule": false, + "hasPegs": false, + "isMat": false, + "isExtension": false, + "imageUrl": "images/module/autograph/04-AU-xxx-USHAPE-B/04-AU-BIR-USHAPE-B/04-AU-BIR-USHAPE-B.jpg", + "genericName": "04-AU-xxx-USHAPE-B", "categorySlug": ["all", "accessories"] }, { "partNumber": "04-AU-USHAPE-WAL-B", - "bundlePath": "modules/autograph/04-au-ushape-xxx-b/04-au-ushape-wal-b/module", + "bundlePath": "modules/autograph/04-au-xxx-ushape-b/04-au-wal-ushape-b/module", + "finish": "walnut", + "collection": "autograph", + "rules": "{\r\n \"partNumber\": \"04-AU-USHAPE-WAL-B\",\r\n \"finishes\": [\r\n \"04-AU-USHAPE-BIR-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 55,\r\n \"inches\": \"2\\\" 5/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true,\r\n \"options\": [\r\n \"04-AU-ACCENT-SW-141\",\r\n \"04-AU-ACCENT-MB-141\",\r\n \"04-AU-ACCENT-SD-141\",\r\n \"04-AU-ACCENT-AN-141\",\r\n \"04-AU-ACCENT-AU79-141\"\r\n ]\r\n }\r\n}", + "isSubmodule": false, + "hasPegs": false, + "isMat": false, + "isExtension": false, + "imageUrl": "images/module/autograph/04-AU-xxx-USHAPE-B/04-AU-WAL-USHAPE-B/04-AU-WAL-USHAPE-B.jpg", + "genericName": "04-AU-xxx-USHAPE-B", + "categorySlug": ["all", "accessories"] + }, + { + "partNumber": "04-AU-WAL-USHAPE-B", + "bundlePath": "modules/autograph/04-au-xxx-ushape-b/04-au-wal-ushape-b/module", "finish": "walnut", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-USHAPE-WAL-B\",\r\n \"finishes\": [\r\n \"04-AU-USHAPE-BIR-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 55,\r\n \"inches\": \"2\\\" 5/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true,\r\n \"options\": [\r\n \"04-AU-ACCENT-SW-141\",\r\n \"04-AU-ACCENT-MB-141\",\r\n \"04-AU-ACCENT-SD-141\",\r\n \"04-AU-ACCENT-AN-141\",\r\n \"04-AU-ACCENT-AU79-141\"\r\n ]\r\n }\r\n}", @@ -3343,8 +3371,8 @@ "hasPegs": false, "isMat": false, "isExtension": false, - "imageUrl": "images/module/autograph/04-AU-USHAPE-xxx-B/04-AU-USHAPE-WAL-B/04-AU-USHAPE-WAL-B.jpg", - "genericName": "04-AU-USHAPE-xxx-B", + "imageUrl": "images/module/autograph/04-AU-xxx-USHAPE-B/04-AU-WAL-USHAPE-B/04-AU-WAL-USHAPE-B.jpg", + "genericName": "04-AU-xxx-USHAPE-B", "categorySlug": ["all", "accessories"] }, { @@ -3376,7 +3404,7 @@ "categorySlug": ["all", "accessories"] }, { - "partNumber": "04-AU-BIR-CD-B.b", + "partNumber": "alt-04-au-bir-cd-b-b", "bundlePath": "modules/autograph/04-au-xxx-cd-b-b/04-au-bir-cd-b-b/module", "finish": "birch", "collection": "autograph", @@ -3390,7 +3418,7 @@ "categorySlug": ["all"] }, { - "partNumber": "04-AU-WAL-CD-B.b", + "partNumber": "alt-04-au-wal-cd-b-b", "bundlePath": "modules/autograph/04-au-xxx-cd-b-b/04-au-wal-cd-b-b/module", "finish": "walnut", "collection": "autograph", @@ -3489,7 +3517,7 @@ }, { "partNumber": "04-AU-BIR-FLUTTED-B", - "bundlePath": "modules/autograph/04-au-xxx-flutted-b/04-au-bir-flutted-b/module", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b/04-au-bir-fluted-b/module", "finish": "birch", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-BIR-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-WAL-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", @@ -3497,13 +3525,41 @@ "hasPegs": false, "isMat": false, "isExtension": false, - "imageUrl": "images/module/autograph/04-AU-xxx-FLUTTED-B/04-AU-BIR-FLUTTED-B/04-AU-BIR-FLUTTED-B.jpg", - "genericName": "04-AU-xxx-FLUTTED-B", + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B/04-AU-BIR-FLUTED-B/04-AU-BIR-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B", + "categorySlug": ["all", "accessories"] + }, + { + "partNumber": "04-AU-BIR-FLUTED-B", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b/04-au-bir-fluted-b/module", + "finish": "birch", + "collection": "autograph", + "rules": "{\r\n \"partNumber\": \"04-AU-BIR-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-WAL-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", + "isSubmodule": false, + "hasPegs": false, + "isMat": false, + "isExtension": false, + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B/04-AU-BIR-FLUTED-B/04-AU-BIR-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B", "categorySlug": ["all", "accessories"] }, { "partNumber": "04-AU-WAL-FLUTTED-B", - "bundlePath": "modules/autograph/04-au-xxx-flutted-b/04-au-wal-flutted-b/module", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b/04-au-wal-fluted-b/module", + "finish": "walnut", + "collection": "autograph", + "rules": "{\r\n \"partNumber\": \"04-AU-WAL-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-BIR-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", + "isSubmodule": false, + "hasPegs": false, + "isMat": false, + "isExtension": false, + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B/04-AU-WAL-FLUTED-B/04-AU-WAL-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B", + "categorySlug": ["all", "accessories"] + }, + { + "partNumber": "04-AU-WAL-FLUTED-B", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b/04-au-wal-fluted-b/module", "finish": "walnut", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-WAL-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-BIR-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", @@ -3511,13 +3567,13 @@ "hasPegs": false, "isMat": false, "isExtension": false, - "imageUrl": "images/module/autograph/04-AU-xxx-FLUTTED-B/04-AU-WAL-FLUTTED-B/04-AU-WAL-FLUTTED-B.jpg", - "genericName": "04-AU-xxx-FLUTTED-B", + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B/04-AU-WAL-FLUTED-B/04-AU-WAL-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B", "categorySlug": ["all", "accessories"] }, { - "partNumber": "04-AU-BIR-FLUTTED-B.b", - "bundlePath": "modules/autograph/04-au-xxx-flutted-b-b/04-au-bir-flutted-b-b/module", + "partNumber": "alt-04-au-bir-flutted-b-b", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b-b/04-au-bir-fluted-b-b/module", "finish": "birch", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-BIR-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-WAL-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", @@ -3525,13 +3581,41 @@ "hasPegs": true, "isMat": false, "isExtension": false, - "imageUrl": "images/module/autograph/04-AU-xxx-FLUTTED-B.b/04-AU-BIR-FLUTTED-B.b/04-AU-BIR-FLUTTED-B.jpg", - "genericName": "04-AU-xxx-FLUTTED-B.b", + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B.b/04-AU-BIR-FLUTED-B.b/04-AU-BIR-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B.b", + "categorySlug": ["all"] + }, + { + "partNumber": "alt-04-au-bir-fluted-b-b", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b-b/04-au-bir-fluted-b-b/module", + "finish": "birch", + "collection": "autograph", + "rules": "{\r\n \"partNumber\": \"04-AU-BIR-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-WAL-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", + "isSubmodule": false, + "hasPegs": true, + "isMat": false, + "isExtension": false, + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B.b/04-AU-BIR-FLUTED-B.b/04-AU-BIR-FLUTTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B.b", + "categorySlug": ["all"] + }, + { + "partNumber": "alt-04-au-wal-flutted-b-b", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b-b/04-au-wal-fluted-b-b/module", + "finish": "walnut", + "collection": "autograph", + "rules": "{\r\n \"partNumber\": \"04-AU-WAL-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-BIR-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", + "isSubmodule": false, + "hasPegs": true, + "isMat": false, + "isExtension": false, + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B.b/04-AU-WAL-FLUTED-B.b/04-AU-WAL-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B.b", "categorySlug": ["all"] }, { - "partNumber": "04-AU-WAL-FLUTTED-B.b", - "bundlePath": "modules/autograph/04-au-xxx-flutted-b-b/04-au-wal-flutted-b-b/module", + "partNumber": "alt-04-au-wal-fluted-b-b", + "bundlePath": "modules/autograph/04-au-xxx-fluted-b-b/04-au-wal-fluted-b-b/module", "finish": "walnut", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-WAL-FLUTTED-B\",\r\n \"finishes\": [\r\n \"04-AU-BIR-FLUTTED-B\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 12,\r\n \"inches\": \"0\\\" 15/32\"\r\n },\r\n \"width\": {\r\n \"min\": {\r\n \"millimeters\": 138.5,\r\n \"inches\": \"5\\\" 7/16\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 152.4,\r\n \"inches\": \"6\\\"\"\r\n }\r\n },\r\n \"depth\": {\r\n \"min\": {\r\n \"millimeters\": 366,\r\n \"inches\": \"14\\\" 13/32\"\r\n },\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", @@ -3539,8 +3623,8 @@ "hasPegs": true, "isMat": false, "isExtension": false, - "imageUrl": "images/module/autograph/04-AU-xxx-FLUTTED-B.b/04-AU-WAL-FLUTTED-B.b/04-AU-WAL-FLUTTED-B.jpg", - "genericName": "04-AU-xxx-FLUTTED-B.b", + "imageUrl": "images/module/autograph/04-AU-xxx-FLUTED-B.b/04-AU-WAL-FLUTED-B.b/04-AU-WAL-FLUTED-B.jpg", + "genericName": "04-AU-xxx-FLUTED-B.b", "categorySlug": ["all"] }, { @@ -3572,7 +3656,7 @@ "categorySlug": ["all", "accessories"] }, { - "partNumber": "04-AU-BIR-KH-B.b", + "partNumber": "alt-04-au-bir-kh-b-b", "bundlePath": "modules/autograph/04-au-xxx-kh-b-b/04-au-bir-kh-b-b/module", "finish": "birch", "collection": "autograph", @@ -3586,7 +3670,7 @@ "categorySlug": ["all"] }, { - "partNumber": "04-AU-WAL-KH-B.b", + "partNumber": "alt-04-au-wal-kh-b-b", "bundlePath": "modules/autograph/04-au-xxx-kh-b-b/04-au-wal-kh-b-b/module", "finish": "walnut", "collection": "autograph", @@ -3684,7 +3768,7 @@ "categorySlug": ["all", "accessories"] }, { - "partNumber": "04-AU-BIR-SLOTTED-B.b", + "partNumber": "alt-04-au-bir-slotted-b-b", "bundlePath": "modules/autograph/04-au-xxx-slotted-b-b/04-au-bir-slotted-b-b/module", "finish": "birch", "collection": "autograph", @@ -3698,7 +3782,7 @@ "categorySlug": ["all"] }, { - "partNumber": "04-AU-WAL-SLOTTED-B.b", + "partNumber": "alt-04-au-wal-slotted-b-b", "bundlePath": "modules/autograph/04-au-xxx-slotted-b-b/04-au-wal-slotted-b-b/module", "finish": "walnut", "collection": "autograph", @@ -4031,6 +4115,16 @@ "imageUrl": "images/module/area/04-AREA-SP-CH/04-AREA-SP-CH.jpg", "genericName": "04-AREA-SP-CH", "shouldHideBasedOnWidth": true + }, + { + "partNumber": "04-AU-BIR-FILLER-1501200", + "bundlePath": "modules/autograph/04-au-xxx-filler-1501200/04-au-bir-filler-1501200/module", + "genericName": "04-AU-xxx-FILLER-1501200" + }, + { + "partNumber": "04-AU-WAL-FILLER-1501200", + "bundlePath": "modules/autograph/04-au-xxx-filler-1501200/04-au-wal-filler-1501200/module", + "genericName": "04-AU-xxx-FILLER-1501200" } ], "moduleTypes": [ @@ -4090,6 +4184,14 @@ "partNumber": "04-AU-WAL-FLUTTED-B", "type": "deep" }, + { + "partNumber": "04-AU-BIR-FLUTED-B", + "type": "deep" + }, + { + "partNumber": "04-AU-WAL-FLUTED-B", + "type": "deep" + }, { "partNumber": "04-AU-BIR-SLOTTED-B", "type": "deep" @@ -4390,6 +4492,14 @@ "partNumber": "04-AU-USHAPE-WAL-B", "type": "shallow" }, + { + "partNumber": "04-AU-BIR-USHAPE-B", + "type": "shallow" + }, + { + "partNumber": "04-AU-WAL-USHAPE-B", + "type": "shallow" + }, { "partNumber": "04-AU-LSHAPE600-AN", "type": "shallow" diff --git a/src/services/fileUpload.ts b/src/services/fileUpload.ts index cbfafdf..303fb1e 100644 --- a/src/services/fileUpload.ts +++ b/src/services/fileUpload.ts @@ -28,7 +28,7 @@ export const fileUploadService = () => { }); }; - const uploadFileToStorage = (file: Buffer, destination: string) => + const uploadFileToStorage = (file: Buffer, destination: string, mimetype?: string) => new Promise(async (resolve, reject) => { if (!AWS_STORAGE_BUCKET_NAME || !AWS_DEFAULT_ACL) { reject(makeError('Environment not set to upload files', 'invalidEnvironment')); @@ -45,7 +45,8 @@ export const fileUploadService = () => { Bucket: bucket, Key: destination, Body: file, - ACL: AWS_DEFAULT_ACL + ACL: AWS_DEFAULT_ACL, + ContentType: mimetype }, (err) => { if (err) return reject(err); diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index 7b2b51f..22bae05 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -3,8 +3,9 @@ import { Locale, Module, PrismaClient } from '@prisma/client'; import { ForbiddenError } from 'apollo-server'; import axios, { AxiosResponse } from 'axios'; import fetch from 'cross-fetch'; -import { helpers } from 'faker'; +import { helpers, image } from 'faker'; import { toNumber } from 'lodash'; +import mime from 'mime'; import path from 'path'; import { URL } from 'url'; import seed from '../../../prisma/seedValues/seed.json'; @@ -98,12 +99,16 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const promises: Promise[] = []; for (let index = 0; index < simultaneousSync; index++) { - const imagePath = storageSyncQueue[index]; + let imagePath = storageSyncQueue[index]; + + if (imagePath.startsWith('/')) { + imagePath = imagePath.substring(1); + } promises.push( new Promise(async (resolve, reject) => { try { - console.log(`Syncing image #${i + 1} of ${initialLength}`); + console.log(`Syncing image #${i + 1} of ${initialLength}. ${decodeURIComponent(imagePath)}`); i++; try { @@ -117,8 +122,10 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // Do nothing, file probably doesn't exist } + const mimetype = mime.lookup(imagePath) || 'application/octet-stream'; + // Upload new image - await fileUpload.uploadFileToStorage(file.data, imagePath); + await fileUpload.uploadFileToStorage(file.data, decodeURIComponent(imagePath), mimetype); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (err: any) { if (err?.response?.status && err.response.status === 404) { @@ -536,7 +543,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); console.log(`Fetching recently created ${drawerTypesToCreate.length} drawer types`); - const recentlyCreatedDrawerTypes = await db.collection.findMany({ + const recentlyCreatedDrawerTypes = await db.type.findMany({ where: { externalId: { in: drawerTypesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, @@ -590,6 +597,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (!skipDatabase && finishes && finishes.length > 0) { const existingFinishes = await db.finish.findMany({ select: { + id: true, externalId: true, slug: true, thumbnailUrl: true, @@ -656,15 +664,17 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { : undefined } }); + + await db.collectionFinishes.deleteMany({ where: { finish: { externalId: currentFinish.externalId } } }); } + let recentlyCreatedFinishes: { id: number; externalId: string | null; slug: string }[] = []; + if (finishesToCreate && finishesToCreate.length > 0) { console.log(`Batch creating ${finishesToCreate.length} finishes`); await db.finish.createMany({ data: finishesToCreate - .filter( - (finishEdge) => finishEdge?.node?.id && finishEdge?.node?.slug && finishEdge?.node?.image?.fullpath - ) + .filter((finishEdge) => finishEdge?.node?.id && finishEdge?.node?.slug) .map((finishEdge) => { let slug = finishEdge?.node?.slug?.trim() as string; @@ -687,7 +697,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); console.log(`Fetching recently created ${finishesToCreate.length} finishes`); - const recentlyCreatedFinishes = await db.finish.findMany({ + recentlyCreatedFinishes = await db.finish.findMany({ where: { externalId: { in: finishesToCreate.map((x) => x?.node?.id as string).filter((x) => !!x) } }, select: { id: true, @@ -696,16 +706,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }); - const collectionsForFinishes = await db.collection.findMany({ - where: { - slug: { - in: seed.collectionFinishes - .filter((colFin) => recentlyCreatedFinishes.some((dbFin) => dbFin.slug === colFin.finish)) - .map((x) => x.collection) - } - } - }); - console.log(`Batch creating ${recentlyCreatedFinishes.length} finish translations`); await db.finishTranslations.createMany({ data: recentlyCreatedFinishes.map((dbFinish) => { @@ -720,22 +720,49 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }; }) }); + } else { + console.log(`No finish to create`); + } - console.log(`Batch creating ${recentlyCreatedFinishes.length} collection finishes`); - await db.collectionFinishes.createMany({ - data: recentlyCreatedFinishes.map((dbFinish) => { + const allFinishes = [...recentlyCreatedFinishes, ...existingFinishes]; + + const collectionsForFinishes = await db.collection.findMany({ + where: { + slug: { + in: seed.collectionFinishes + .filter((colFin) => allFinishes.some((dbFin) => dbFin.slug === colFin.finish)) + .map((x) => x.collection) + } + } + }); + + console.log(`Batch creating ${allFinishes.length} collection finishes`); + await db.collectionFinishes.createMany({ + skipDuplicates: true, + data: allFinishes + .map((dbFinish) => { const collectionFinish = seed.collectionFinishes.find((x) => x.finish === dbFinish.slug); const collection = collectionsForFinishes.find((x) => x.slug === collectionFinish?.collection); + if (!collection) { + return undefined; + } + return { finishId: dbFinish.id, collectionId: collection?.id || -1 }; }) - }); - } else { - console.log(`No finish to create`); - } + .filter((x) => !!x) + .map( + (x) => + // Casting because we filtered right before + x as { + finishId: number; + collectionId: number; + } + ) + }); } } catch (err) { logging.error(err, 'Error fetching Marathon finishes'); @@ -775,11 +802,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .slugify(`${slideEdge.supplier}-${slideEdge.product}-${slideEdge.collection}`) .toLowerCase(); - let existingSlide = await db.slide.findUnique({ where: { slug: slideSlug } }); + const existingSlide = await db.slide.findUnique({ where: { slug: slideSlug } }); + const depths = slideEdge.depth; if (!existingSlide) { if (!skipDatabase) { - existingSlide = await db.slide.create({ + // Commented since we're never updating it anyway + /* existingSlide = */ await db.slide.create({ data: { slug: slideSlug, formula: slideEdge.formula, @@ -800,6 +829,14 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { connect: { slug: slideEdge.collection } + }, + depths: { + createMany: { + data: depths.map(({ roundedValue, value }) => ({ + display: `${roundedValue}mm`, + depth: toNumber(value) + })) + } } } }); @@ -832,19 +869,17 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { // } // }); // await db.slideDepth.deleteMany({ where: { slideId: existingSlide.id } }); + // if (depths?.length > 0) { + // await db.slideDepth.createMany({ + // data: depths.map(({ roundedValue, value }) => ({ + // display: `${roundedValue}mm`, + // depth: toNumber(value), + // slideId: existingSlide?.id || -1 + // })) + // }); + // } } } - - const depths = slideEdge.depth; - if (!skipDatabase && existingSlide && depths?.length > 0) { - await db.slideDepth.createMany({ - data: depths.map(({ roundedValue, value }) => ({ - display: `${roundedValue}mm`, - depth: toNumber(value), - slideId: existingSlide?.id || -1 - })) - }); - } } } } catch (err) { @@ -871,8 +906,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Upserting module ${module.partNumber} ${module.externalId}`); - //const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - //makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); + const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); const existingProduct = await db.module.findUnique({ where: { @@ -892,6 +927,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { let { partNumber } = module; + const bundleUrl = seed.modules.find((x) => x.partNumber.toLowerCase() === partNumber.toLowerCase())?.bundlePath; + if (!existingProduct && partNumberProduct?.length > 0) { partNumber = `${partNumber}-${partNumberProduct.length}`; } @@ -907,6 +944,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { data: { ...moduleRest, partNumber, + bundleUrl, rules: module, originalMarathonProductJson, finish: { @@ -942,6 +980,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { : undefined } }); + + if (moduleRest.thumbnailUrl) storageSyncQueue.push(moduleRest.thumbnailUrl); } } else { status = 'updated'; @@ -953,6 +993,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { data: { ...moduleRest, partNumber, + bundleUrl, rules, originalMarathonProductJson, finish: { @@ -989,6 +1030,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } }); + if (moduleRest.thumbnailUrl) storageSyncQueue.push(moduleRest.thumbnailUrl); + // If this module already exists, it already has all the relations, so delete them for them to be created // This is needed in case they completely changed the values here await db.moduleType.deleteMany({ where: { module: { id: existingProduct.id } } }); @@ -1076,8 +1119,6 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { })) }); } - - if (resultModule.thumbnailUrl) storageSyncQueue.push(resultModule.thumbnailUrl); } // }); @@ -1139,6 +1180,9 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const module = productEdge?.node; + const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + makeFile(dir, path.join(`pre-rules/${productEdge?.node?.partNumber}.json`), module); + // So we grab a finish Id if any(there should always be one) const finishId = existingFinishes.find((finish) => finish.externalId === module?.spFinish?.id)?.id || undefined; @@ -1166,9 +1210,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter((x) => !!x?.node) .flatMap((productEdge) => { try { + const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + makeFile(dir, path.join(`marathon/${productEdge?.node?.partNumber}.json`), productEdge); // Casting since we filtered it previously + const rules = makeRulesFromMarathonModule(productEdge?.node as MarathonModule); + makeFile(dir, path.join(`rules/${productEdge?.node?.partNumber}.json`), rules); return { - ...makeRulesFromMarathonModule(productEdge?.node as MarathonModule), + ...rules, originalMarathonProductJson: productEdge }; } catch (err) { From 8554b56c227fa21dfd97ff3aa5f080d30c2f8b9d Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Wed, 27 Apr 2022 16:20:03 -0300 Subject: [PATCH 09/13] fix: makes sure sync doesn't overwrite --- .../migration.sql | 2 + .../migration.sql | 3 + prisma/schema.prisma | 10 +- src/generated/nexus-prisma.d.ts | 28 +- src/generated/nexus.d.ts | 364 ++++++++++++++++-- src/generated/schema.graphql | 352 +++++++++++++++-- src/services/marathon/index.ts | 135 +++++-- src/services/marathon/parsing/parseRules.ts | 4 +- src/services/project.ts | 1 - 9 files changed, 802 insertions(+), 97 deletions(-) create mode 100644 prisma/migrations/20220427142747_makes_owner_relationship/migration.sql create mode 100644 prisma/migrations/20220427170908_adds_updatedat_to_list/migration.sql diff --git a/prisma/migrations/20220427142747_makes_owner_relationship/migration.sql b/prisma/migrations/20220427142747_makes_owner_relationship/migration.sql new file mode 100644 index 0000000..8b9091b --- /dev/null +++ b/prisma/migrations/20220427142747_makes_owner_relationship/migration.sql @@ -0,0 +1,2 @@ +-- AddForeignKey +ALTER TABLE `Module` ADD FOREIGN KEY (`ownerExternalId`) REFERENCES `Module`(`externalId`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20220427170908_adds_updatedat_to_list/migration.sql b/prisma/migrations/20220427170908_adds_updatedat_to_list/migration.sql new file mode 100644 index 0000000..025576c --- /dev/null +++ b/prisma/migrations/20220427170908_adds_updatedat_to_list/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE `List` ADD COLUMN `createdAt` DATETIME(0) DEFAULT CURRENT_TIMESTAMP(0), + ADD COLUMN `updatedAt` DATETIME(0) DEFAULT CURRENT_TIMESTAMP(0); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 59eed0f..3f6620d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -86,11 +86,13 @@ model FinishTranslations { } model List { - id Int @id @default(autoincrement()) - externalId String? @unique + id Int @id @default(autoincrement()) + externalId String? @unique name String? + createdAt DateTime? @default(now()) @db.DateTime(0) + updatedAt DateTime? @default(now()) @updatedAt @db.DateTime(0) projectId Int? - project Project? @relation(fields: [projectId], references: [id]) + project Project? @relation(fields: [projectId], references: [id]) } model ModuleAttachments { @@ -106,6 +108,7 @@ model Module { partNumber String @unique externalId String? @unique ownerExternalId String? + owner Module? @relation("ownerRelation", fields: [ownerExternalId], references: [externalId]) description String? thumbnailUrl String? @db.VarChar(255) bundleUrl String? @db.VarChar(255) @@ -139,6 +142,7 @@ model Module { moduleAttachments ModuleAttachments[] @relation("module_moduleAttachments") moduleAttachedTo ModuleAttachments[] @relation("attachment_moduleAttachments") moduleType ModuleType[] + modulesIOwn Module[] @relation("ownerRelation") } model Project { diff --git a/src/generated/nexus-prisma.d.ts b/src/generated/nexus-prisma.d.ts index a1810f2..5586d50 100644 --- a/src/generated/nexus-prisma.d.ts +++ b/src/generated/nexus-prisma.d.ts @@ -67,15 +67,15 @@ interface NexusPrismaInputs { ordering: 'id' | 'locale' | 'name' | 'description' | 'finishId' } lists: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'externalId' | 'name' | 'projectId' | 'project' - ordering: 'id' | 'externalId' | 'name' | 'projectId' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'externalId' | 'name' | 'createdAt' | 'updatedAt' | 'projectId' | 'project' + ordering: 'id' | 'externalId' | 'name' | 'createdAt' | 'updatedAt' | 'projectId' } moduleAttachments: { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'moduleId' | 'module' | 'attachmentId' | 'attachment' ordering: 'id' | 'moduleId' | 'attachmentId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } projects: { @@ -138,7 +138,7 @@ interface NexusPrismaInputs { ordering: 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'collectionId' | 'finishId' | 'slideId' | 'slideDepthId' | 'userId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } collectionFinishes: { @@ -166,7 +166,7 @@ interface NexusPrismaInputs { ordering: 'id' | 'slug' | 'title' | 'cabinetWidth' | 'calculatedWidth' | 'gable' | 'typeId' | 'hasPegs' | 'collectionId' | 'finishId' | 'slideId' | 'slideDepthId' | 'userId' } modules: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } collectionFinishes: { @@ -193,15 +193,15 @@ interface NexusPrismaInputs { ordering: 'id' | 'moduleId' | 'categoryId' } defaultLeftExtensionParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } defaultRightExtensionParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } attachmentToAppendParents: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' } moduleAttachments: { @@ -216,6 +216,10 @@ interface NexusPrismaInputs { filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'typeId' | 'moduleId' | 'type' | 'module' ordering: 'id' | 'typeId' | 'moduleId' } + modulesIOwn: { + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'owner' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultLeftExtension' | 'defaultRightExtensionId' | 'defaultRightExtension' | 'attachmentToAppendId' | 'attachmentToAppend' | 'finishId' | 'finish' | 'collectionId' | 'collection' | 'rules' | 'originalMarathonProductJson' | 'projectModules' | 'moduleCategories' | 'defaultLeftExtensionParents' | 'defaultRightExtensionParents' | 'attachmentToAppendParents' | 'moduleAttachments' | 'moduleAttachedTo' | 'moduleType' | 'modulesIOwn' + ordering: 'id' | 'partNumber' | 'externalId' | 'ownerExternalId' | 'description' | 'thumbnailUrl' | 'bundleUrl' | 'isSubmodule' | 'hasPegs' | 'isMat' | 'isExtension' | 'shouldHideBasedOnWidth' | 'isVirtualProduct' | 'createdAt' | 'updatedAt' | 'alwaysDisplay' | 'isEdge' | 'defaultLeftExtensionId' | 'defaultRightExtensionId' | 'attachmentToAppendId' | 'finishId' | 'collectionId' | 'rules' | 'originalMarathonProductJson' + } } Project: { projectModules: { @@ -223,8 +227,8 @@ interface NexusPrismaInputs { ordering: 'id' | 'nanoId' | 'posX' | 'posY' | 'posZ' | 'rotY' | 'moduleId' | 'parentId' | 'parentNanoId' | 'projectId' } lists: { - filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'externalId' | 'name' | 'projectId' | 'project' - ordering: 'id' | 'externalId' | 'name' | 'projectId' + filtering: 'AND' | 'OR' | 'NOT' | 'id' | 'externalId' | 'name' | 'createdAt' | 'updatedAt' | 'projectId' | 'project' + ordering: 'id' | 'externalId' | 'name' | 'createdAt' | 'updatedAt' | 'projectId' } } ProjectModule: { @@ -522,6 +526,8 @@ interface NexusPrismaOutputs { id: 'Int' externalId: 'String' name: 'String' + createdAt: 'DateTime' + updatedAt: 'DateTime' projectId: 'Int' project: 'Project' } @@ -537,6 +543,7 @@ interface NexusPrismaOutputs { partNumber: 'String' externalId: 'String' ownerExternalId: 'String' + owner: 'Module' description: 'String' thumbnailUrl: 'String' bundleUrl: 'String' @@ -570,6 +577,7 @@ interface NexusPrismaOutputs { moduleAttachments: 'ModuleAttachments' moduleAttachedTo: 'ModuleAttachments' moduleType: 'ModuleType' + modulesIOwn: 'Module' } Project: { id: 'Int' diff --git a/src/generated/nexus.d.ts b/src/generated/nexus.d.ts index 05655f3..75b65c3 100644 --- a/src/generated/nexus.d.ts +++ b/src/generated/nexus.d.ts @@ -602,6 +602,17 @@ export interface NexusGenInputs { not?: NexusGenInputs['NestedDateTimeFilter'] | null; // NestedDateTimeFilter notIn?: NexusGenScalars['DateTime'][] | null; // [DateTime!] }; + DateTimeNullableFilter: { + // input type + equals?: NexusGenScalars['DateTime'] | null; // DateTime + gt?: NexusGenScalars['DateTime'] | null; // DateTime + gte?: NexusGenScalars['DateTime'] | null; // DateTime + in?: NexusGenScalars['DateTime'][] | null; // [DateTime!] + lt?: NexusGenScalars['DateTime'] | null; // DateTime + lte?: NexusGenScalars['DateTime'] | null; // DateTime + not?: NexusGenInputs['NestedDateTimeNullableFilter'] | null; // NestedDateTimeNullableFilter + notIn?: NexusGenScalars['DateTime'][] | null; // [DateTime!] + }; EnumLocaleFieldUpdateOperationsInput: { // input type set?: NexusGenEnums['Locale'] | null; // Locale @@ -938,9 +949,11 @@ export interface NexusGenInputs { }; ListCreateManyProjectInput: { // input type + createdAt?: NexusGenScalars['DateTime'] | null; // DateTime externalId?: string | null; // String id?: number | null; // Int name?: string | null; // String + updatedAt?: NexusGenScalars['DateTime'] | null; // DateTime }; ListCreateManyProjectInputEnvelope: { // input type @@ -961,8 +974,10 @@ export interface NexusGenInputs { }; ListCreateWithoutProjectInput: { // input type + createdAt?: NexusGenScalars['DateTime'] | null; // DateTime externalId?: string | null; // String name?: string | null; // String + updatedAt?: NexusGenScalars['DateTime'] | null; // DateTime }; ListListRelationFilter: { // input type @@ -975,15 +990,19 @@ export interface NexusGenInputs { AND?: NexusGenInputs['ListScalarWhereInput'][] | null; // [ListScalarWhereInput!] NOT?: NexusGenInputs['ListScalarWhereInput'][] | null; // [ListScalarWhereInput!] OR?: NexusGenInputs['ListScalarWhereInput'][] | null; // [ListScalarWhereInput!] + createdAt?: NexusGenInputs['DateTimeNullableFilter'] | null; // DateTimeNullableFilter externalId?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter id?: NexusGenInputs['IntFilter'] | null; // IntFilter name?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter projectId?: NexusGenInputs['IntNullableFilter'] | null; // IntNullableFilter + updatedAt?: NexusGenInputs['DateTimeNullableFilter'] | null; // DateTimeNullableFilter }; ListUpdateManyMutationInput: { // input type + createdAt?: NexusGenInputs['NullableDateTimeFieldUpdateOperationsInput'] | null; // NullableDateTimeFieldUpdateOperationsInput externalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput name?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + updatedAt?: NexusGenInputs['NullableDateTimeFieldUpdateOperationsInput'] | null; // NullableDateTimeFieldUpdateOperationsInput }; ListUpdateManyWithWhereWithoutProjectInput: { // input type @@ -1011,8 +1030,10 @@ export interface NexusGenInputs { }; ListUpdateWithoutProjectInput: { // input type + createdAt?: NexusGenInputs['NullableDateTimeFieldUpdateOperationsInput'] | null; // NullableDateTimeFieldUpdateOperationsInput externalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput name?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + updatedAt?: NexusGenInputs['NullableDateTimeFieldUpdateOperationsInput'] | null; // NullableDateTimeFieldUpdateOperationsInput }; ListUpsertWithWhereUniqueWithoutProjectInput: { // input type @@ -1025,11 +1046,13 @@ export interface NexusGenInputs { AND?: NexusGenInputs['ListWhereInput'][] | null; // [ListWhereInput!] NOT?: NexusGenInputs['ListWhereInput'][] | null; // [ListWhereInput!] OR?: NexusGenInputs['ListWhereInput'][] | null; // [ListWhereInput!] + createdAt?: NexusGenInputs['DateTimeNullableFilter'] | null; // DateTimeNullableFilter externalId?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter id?: NexusGenInputs['IntFilter'] | null; // IntFilter name?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter project?: NexusGenInputs['ProjectWhereInput'] | null; // ProjectWhereInput projectId?: NexusGenInputs['IntNullableFilter'] | null; // IntNullableFilter + updatedAt?: NexusGenInputs['DateTimeNullableFilter'] | null; // DateTimeNullableFilter }; ListWhereUniqueInput: { // input type @@ -1445,6 +1468,37 @@ export interface NexusGenInputs { data?: NexusGenInputs['ModuleCreateManyFinishInput'][] | null; // [ModuleCreateManyFinishInput!] skipDuplicates?: boolean | null; // Boolean }; + ModuleCreateManyOwnerInput: { + // input type + alwaysDisplay?: boolean | null; // Boolean + attachmentToAppendId?: number | null; // Int + bundleUrl?: string | null; // String + collectionId: number; // Int! + createdAt?: NexusGenScalars['DateTime'] | null; // DateTime + defaultLeftExtensionId?: number | null; // Int + defaultRightExtensionId?: number | null; // Int + description?: string | null; // String + externalId?: string | null; // String + finishId: number; // Int! + hasPegs?: boolean | null; // Boolean + id?: number | null; // Int + isEdge?: boolean | null; // Boolean + isExtension?: boolean | null; // Boolean + isMat?: boolean | null; // Boolean + isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + partNumber: string; // String! + rules?: NexusGenScalars['Json'] | null; // Json + shouldHideBasedOnWidth?: boolean | null; // Boolean + thumbnailUrl?: string | null; // String + updatedAt?: NexusGenScalars['DateTime'] | null; // DateTime + }; + ModuleCreateManyOwnerInputEnvelope: { + // input type + data?: NexusGenInputs['ModuleCreateManyOwnerInput'][] | null; // [ModuleCreateManyOwnerInput!] + skipDuplicates?: boolean | null; // Boolean + }; ModuleCreateNestedManyWithoutAttachmentToAppendInput: { // input type connect?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] @@ -1480,6 +1534,13 @@ export interface NexusGenInputs { create?: NexusGenInputs['ModuleCreateWithoutFinishInput'][] | null; // [ModuleCreateWithoutFinishInput!] createMany?: NexusGenInputs['ModuleCreateManyFinishInputEnvelope'] | null; // ModuleCreateManyFinishInputEnvelope }; + ModuleCreateNestedManyWithoutOwnerInput: { + // input type + connect?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] + connectOrCreate?: NexusGenInputs['ModuleCreateOrConnectWithoutOwnerInput'][] | null; // [ModuleCreateOrConnectWithoutOwnerInput!] + create?: NexusGenInputs['ModuleCreateWithoutOwnerInput'][] | null; // [ModuleCreateWithoutOwnerInput!] + createMany?: NexusGenInputs['ModuleCreateManyOwnerInputEnvelope'] | null; // ModuleCreateManyOwnerInputEnvelope + }; ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput: { // input type connect?: NexusGenInputs['ModuleWhereUniqueInput'] | null; // ModuleWhereUniqueInput @@ -1516,6 +1577,12 @@ export interface NexusGenInputs { connectOrCreate?: NexusGenInputs['ModuleCreateOrConnectWithoutModuleTypeInput'] | null; // ModuleCreateOrConnectWithoutModuleTypeInput create?: NexusGenInputs['ModuleCreateWithoutModuleTypeInput'] | null; // ModuleCreateWithoutModuleTypeInput }; + ModuleCreateNestedOneWithoutModulesIOwnInput: { + // input type + connect?: NexusGenInputs['ModuleWhereUniqueInput'] | null; // ModuleWhereUniqueInput + connectOrCreate?: NexusGenInputs['ModuleCreateOrConnectWithoutModulesIOwnInput'] | null; // ModuleCreateOrConnectWithoutModulesIOwnInput + create?: NexusGenInputs['ModuleCreateWithoutModulesIOwnInput'] | null; // ModuleCreateWithoutModulesIOwnInput + }; ModuleCreateNestedOneWithoutProjectModulesInput: { // input type connect?: NexusGenInputs['ModuleWhereUniqueInput'] | null; // ModuleWhereUniqueInput @@ -1577,6 +1644,16 @@ export interface NexusGenInputs { create: NexusGenInputs['ModuleCreateWithoutModuleTypeInput']; // ModuleCreateWithoutModuleTypeInput! where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! }; + ModuleCreateOrConnectWithoutModulesIOwnInput: { + // input type + create: NexusGenInputs['ModuleCreateWithoutModulesIOwnInput']; // ModuleCreateWithoutModulesIOwnInput! + where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! + }; + ModuleCreateOrConnectWithoutOwnerInput: { + // input type + create: NexusGenInputs['ModuleCreateWithoutOwnerInput']; // ModuleCreateWithoutOwnerInput! + where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! + }; ModuleCreateOrConnectWithoutProjectModulesInput: { // input type create: NexusGenInputs['ModuleCreateWithoutProjectModulesInput']; // ModuleCreateWithoutProjectModulesInput! @@ -1606,8 +1683,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1639,8 +1717,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1672,8 +1751,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1705,8 +1785,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1738,8 +1819,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1771,8 +1853,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1804,8 +1887,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1837,8 +1921,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1870,8 +1955,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1903,8 +1989,9 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1936,8 +2023,77 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput + partNumber: string; // String! + projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput + rules?: NexusGenScalars['Json'] | null; // Json + shouldHideBasedOnWidth?: boolean | null; // Boolean + thumbnailUrl?: string | null; // String + updatedAt?: NexusGenScalars['DateTime'] | null; // DateTime + }; + ModuleCreateWithoutModulesIOwnInput: { + // input type + alwaysDisplay?: boolean | null; // Boolean + attachmentToAppend?: NexusGenInputs['ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput'] | null; // ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents?: NexusGenInputs['ModuleCreateNestedManyWithoutAttachmentToAppendInput'] | null; // ModuleCreateNestedManyWithoutAttachmentToAppendInput + bundleUrl?: string | null; // String + collection: NexusGenInputs['CollectionCreateNestedOneWithoutModulesInput']; // CollectionCreateNestedOneWithoutModulesInput! + createdAt?: NexusGenScalars['DateTime'] | null; // DateTime + defaultLeftExtension?: NexusGenInputs['ModuleCreateNestedOneWithoutDefaultLeftExtensionParentsInput'] | null; // ModuleCreateNestedOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents?: NexusGenInputs['ModuleCreateNestedManyWithoutDefaultLeftExtensionInput'] | null; // ModuleCreateNestedManyWithoutDefaultLeftExtensionInput + defaultRightExtension?: NexusGenInputs['ModuleCreateNestedOneWithoutDefaultRightExtensionParentsInput'] | null; // ModuleCreateNestedOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents?: NexusGenInputs['ModuleCreateNestedManyWithoutDefaultRightExtensionInput'] | null; // ModuleCreateNestedManyWithoutDefaultRightExtensionInput + description?: string | null; // String + externalId?: string | null; // String + finish: NexusGenInputs['FinishCreateNestedOneWithoutModulesInput']; // FinishCreateNestedOneWithoutModulesInput! + hasPegs?: boolean | null; // Boolean + isEdge?: boolean | null; // Boolean + isExtension?: boolean | null; // Boolean + isMat?: boolean | null; // Boolean + isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean + moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput + moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput + moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput + moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput + partNumber: string; // String! + projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput + rules?: NexusGenScalars['Json'] | null; // Json + shouldHideBasedOnWidth?: boolean | null; // Boolean + thumbnailUrl?: string | null; // String + updatedAt?: NexusGenScalars['DateTime'] | null; // DateTime + }; + ModuleCreateWithoutOwnerInput: { + // input type + alwaysDisplay?: boolean | null; // Boolean + attachmentToAppend?: NexusGenInputs['ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput'] | null; // ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents?: NexusGenInputs['ModuleCreateNestedManyWithoutAttachmentToAppendInput'] | null; // ModuleCreateNestedManyWithoutAttachmentToAppendInput + bundleUrl?: string | null; // String + collection: NexusGenInputs['CollectionCreateNestedOneWithoutModulesInput']; // CollectionCreateNestedOneWithoutModulesInput! + createdAt?: NexusGenScalars['DateTime'] | null; // DateTime + defaultLeftExtension?: NexusGenInputs['ModuleCreateNestedOneWithoutDefaultLeftExtensionParentsInput'] | null; // ModuleCreateNestedOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents?: NexusGenInputs['ModuleCreateNestedManyWithoutDefaultLeftExtensionInput'] | null; // ModuleCreateNestedManyWithoutDefaultLeftExtensionInput + defaultRightExtension?: NexusGenInputs['ModuleCreateNestedOneWithoutDefaultRightExtensionParentsInput'] | null; // ModuleCreateNestedOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents?: NexusGenInputs['ModuleCreateNestedManyWithoutDefaultRightExtensionInput'] | null; // ModuleCreateNestedManyWithoutDefaultRightExtensionInput + description?: string | null; // String + externalId?: string | null; // String + finish: NexusGenInputs['FinishCreateNestedOneWithoutModulesInput']; // FinishCreateNestedOneWithoutModulesInput! + hasPegs?: boolean | null; // Boolean + isEdge?: boolean | null; // Boolean + isExtension?: boolean | null; // Boolean + isMat?: boolean | null; // Boolean + isSubmodule?: boolean | null; // Boolean + isVirtualProduct?: boolean | null; // Boolean + moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutAttachmentInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutAttachmentInput + moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput + moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput + moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String partNumber: string; // String! projectModules?: NexusGenInputs['ProjectModuleCreateNestedManyWithoutModuleInput'] | null; // ProjectModuleCreateNestedManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -1970,8 +2126,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsCreateNestedManyWithoutModuleInput'] | null; // ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryCreateNestedManyWithoutModuleInput'] | null; // ModuleCategoryCreateNestedManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeCreateNestedManyWithoutModuleInput'] | null; // ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleCreateNestedManyWithoutOwnerInput'] | null; // ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: string | null; // String + owner?: NexusGenInputs['ModuleCreateNestedOneWithoutModulesIOwnInput'] | null; // ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: string; // String! rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: boolean | null; // Boolean @@ -2209,7 +2366,6 @@ export interface NexusGenInputs { isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2241,6 +2397,11 @@ export interface NexusGenInputs { data: NexusGenInputs['ModuleUpdateManyMutationInput']; // ModuleUpdateManyMutationInput! where: NexusGenInputs['ModuleScalarWhereInput']; // ModuleScalarWhereInput! }; + ModuleUpdateManyWithWhereWithoutOwnerInput: { + // input type + data: NexusGenInputs['ModuleUpdateManyMutationInput']; // ModuleUpdateManyMutationInput! + where: NexusGenInputs['ModuleScalarWhereInput']; // ModuleScalarWhereInput! + }; ModuleUpdateManyWithoutAttachmentToAppendInput: { // input type connect?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] @@ -2311,6 +2472,20 @@ export interface NexusGenInputs { updateMany?: NexusGenInputs['ModuleUpdateManyWithWhereWithoutFinishInput'][] | null; // [ModuleUpdateManyWithWhereWithoutFinishInput!] upsert?: NexusGenInputs['ModuleUpsertWithWhereUniqueWithoutFinishInput'][] | null; // [ModuleUpsertWithWhereUniqueWithoutFinishInput!] }; + ModuleUpdateManyWithoutOwnerInput: { + // input type + connect?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] + connectOrCreate?: NexusGenInputs['ModuleCreateOrConnectWithoutOwnerInput'][] | null; // [ModuleCreateOrConnectWithoutOwnerInput!] + create?: NexusGenInputs['ModuleCreateWithoutOwnerInput'][] | null; // [ModuleCreateWithoutOwnerInput!] + createMany?: NexusGenInputs['ModuleCreateManyOwnerInputEnvelope'] | null; // ModuleCreateManyOwnerInputEnvelope + delete?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] + deleteMany?: NexusGenInputs['ModuleScalarWhereInput'][] | null; // [ModuleScalarWhereInput!] + disconnect?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] + set?: NexusGenInputs['ModuleWhereUniqueInput'][] | null; // [ModuleWhereUniqueInput!] + update?: NexusGenInputs['ModuleUpdateWithWhereUniqueWithoutOwnerInput'][] | null; // [ModuleUpdateWithWhereUniqueWithoutOwnerInput!] + updateMany?: NexusGenInputs['ModuleUpdateManyWithWhereWithoutOwnerInput'][] | null; // [ModuleUpdateManyWithWhereWithoutOwnerInput!] + upsert?: NexusGenInputs['ModuleUpsertWithWhereUniqueWithoutOwnerInput'][] | null; // [ModuleUpsertWithWhereUniqueWithoutOwnerInput!] + }; ModuleUpdateOneRequiredWithoutModuleAttachedToInput: { // input type connect?: NexusGenInputs['ModuleWhereUniqueInput'] | null; // ModuleWhereUniqueInput @@ -2373,6 +2548,16 @@ export interface NexusGenInputs { update?: NexusGenInputs['ModuleUpdateWithoutDefaultRightExtensionParentsInput'] | null; // ModuleUpdateWithoutDefaultRightExtensionParentsInput upsert?: NexusGenInputs['ModuleUpsertWithoutDefaultRightExtensionParentsInput'] | null; // ModuleUpsertWithoutDefaultRightExtensionParentsInput }; + ModuleUpdateOneWithoutModulesIOwnInput: { + // input type + connect?: NexusGenInputs['ModuleWhereUniqueInput'] | null; // ModuleWhereUniqueInput + connectOrCreate?: NexusGenInputs['ModuleCreateOrConnectWithoutModulesIOwnInput'] | null; // ModuleCreateOrConnectWithoutModulesIOwnInput + create?: NexusGenInputs['ModuleCreateWithoutModulesIOwnInput'] | null; // ModuleCreateWithoutModulesIOwnInput + delete?: boolean | null; // Boolean + disconnect?: boolean | null; // Boolean + update?: NexusGenInputs['ModuleUpdateWithoutModulesIOwnInput'] | null; // ModuleUpdateWithoutModulesIOwnInput + upsert?: NexusGenInputs['ModuleUpsertWithoutModulesIOwnInput'] | null; // ModuleUpsertWithoutModulesIOwnInput + }; ModuleUpdateWithWhereUniqueWithoutAttachmentToAppendInput: { // input type data: NexusGenInputs['ModuleUpdateWithoutAttachmentToAppendInput']; // ModuleUpdateWithoutAttachmentToAppendInput! @@ -2398,6 +2583,11 @@ export interface NexusGenInputs { data: NexusGenInputs['ModuleUpdateWithoutFinishInput']; // ModuleUpdateWithoutFinishInput! where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! }; + ModuleUpdateWithWhereUniqueWithoutOwnerInput: { + // input type + data: NexusGenInputs['ModuleUpdateWithoutOwnerInput']; // ModuleUpdateWithoutOwnerInput! + where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! + }; ModuleUpdateWithoutAttachmentToAppendInput: { // input type alwaysDisplay?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2422,8 +2612,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2455,8 +2646,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2488,8 +2680,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2521,8 +2714,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2554,8 +2748,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2587,8 +2782,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2620,8 +2816,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2653,8 +2850,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2686,8 +2884,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2719,8 +2918,9 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2752,8 +2952,77 @@ export interface NexusGenInputs { moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput + partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput + projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput + rules?: NexusGenScalars['Json'] | null; // Json + shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + thumbnailUrl?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + updatedAt?: NexusGenInputs['DateTimeFieldUpdateOperationsInput'] | null; // DateTimeFieldUpdateOperationsInput + }; + ModuleUpdateWithoutModulesIOwnInput: { + // input type + alwaysDisplay?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + attachmentToAppend?: NexusGenInputs['ModuleUpdateOneWithoutAttachmentToAppendParentsInput'] | null; // ModuleUpdateOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents?: NexusGenInputs['ModuleUpdateManyWithoutAttachmentToAppendInput'] | null; // ModuleUpdateManyWithoutAttachmentToAppendInput + bundleUrl?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + collection?: NexusGenInputs['CollectionUpdateOneRequiredWithoutModulesInput'] | null; // CollectionUpdateOneRequiredWithoutModulesInput + createdAt?: NexusGenInputs['DateTimeFieldUpdateOperationsInput'] | null; // DateTimeFieldUpdateOperationsInput + defaultLeftExtension?: NexusGenInputs['ModuleUpdateOneWithoutDefaultLeftExtensionParentsInput'] | null; // ModuleUpdateOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents?: NexusGenInputs['ModuleUpdateManyWithoutDefaultLeftExtensionInput'] | null; // ModuleUpdateManyWithoutDefaultLeftExtensionInput + defaultRightExtension?: NexusGenInputs['ModuleUpdateOneWithoutDefaultRightExtensionParentsInput'] | null; // ModuleUpdateOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents?: NexusGenInputs['ModuleUpdateManyWithoutDefaultRightExtensionInput'] | null; // ModuleUpdateManyWithoutDefaultRightExtensionInput + description?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + externalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + finish?: NexusGenInputs['FinishUpdateOneRequiredWithoutModulesInput'] | null; // FinishUpdateOneRequiredWithoutModulesInput + hasPegs?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isEdge?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput + moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput + moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput + moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput + partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput + projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput + rules?: NexusGenScalars['Json'] | null; // Json + shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + thumbnailUrl?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + updatedAt?: NexusGenInputs['DateTimeFieldUpdateOperationsInput'] | null; // DateTimeFieldUpdateOperationsInput + }; + ModuleUpdateWithoutOwnerInput: { + // input type + alwaysDisplay?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + attachmentToAppend?: NexusGenInputs['ModuleUpdateOneWithoutAttachmentToAppendParentsInput'] | null; // ModuleUpdateOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents?: NexusGenInputs['ModuleUpdateManyWithoutAttachmentToAppendInput'] | null; // ModuleUpdateManyWithoutAttachmentToAppendInput + bundleUrl?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + collection?: NexusGenInputs['CollectionUpdateOneRequiredWithoutModulesInput'] | null; // CollectionUpdateOneRequiredWithoutModulesInput + createdAt?: NexusGenInputs['DateTimeFieldUpdateOperationsInput'] | null; // DateTimeFieldUpdateOperationsInput + defaultLeftExtension?: NexusGenInputs['ModuleUpdateOneWithoutDefaultLeftExtensionParentsInput'] | null; // ModuleUpdateOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents?: NexusGenInputs['ModuleUpdateManyWithoutDefaultLeftExtensionInput'] | null; // ModuleUpdateManyWithoutDefaultLeftExtensionInput + defaultRightExtension?: NexusGenInputs['ModuleUpdateOneWithoutDefaultRightExtensionParentsInput'] | null; // ModuleUpdateOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents?: NexusGenInputs['ModuleUpdateManyWithoutDefaultRightExtensionInput'] | null; // ModuleUpdateManyWithoutDefaultRightExtensionInput + description?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + externalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + finish?: NexusGenInputs['FinishUpdateOneRequiredWithoutModulesInput'] | null; // FinishUpdateOneRequiredWithoutModulesInput + hasPegs?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isEdge?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isExtension?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isMat?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isSubmodule?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + isVirtualProduct?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput + moduleAttachedTo?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutAttachmentInput'] | null; // ModuleAttachmentsUpdateManyWithoutAttachmentInput + moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput + moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput + moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput projectModules?: NexusGenInputs['ProjectModuleUpdateManyWithoutModuleInput'] | null; // ProjectModuleUpdateManyWithoutModuleInput rules?: NexusGenScalars['Json'] | null; // Json @@ -2786,8 +3055,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsUpdateManyWithoutModuleInput'] | null; // ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories?: NexusGenInputs['ModuleCategoryUpdateManyWithoutModuleInput'] | null; // ModuleCategoryUpdateManyWithoutModuleInput moduleType?: NexusGenInputs['ModuleTypeUpdateManyWithoutModuleInput'] | null; // ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn?: NexusGenInputs['ModuleUpdateManyWithoutOwnerInput'] | null; // ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson?: NexusGenScalars['Json'] | null; // Json - ownerExternalId?: NexusGenInputs['NullableStringFieldUpdateOperationsInput'] | null; // NullableStringFieldUpdateOperationsInput + owner?: NexusGenInputs['ModuleUpdateOneWithoutModulesIOwnInput'] | null; // ModuleUpdateOneWithoutModulesIOwnInput partNumber?: NexusGenInputs['StringFieldUpdateOperationsInput'] | null; // StringFieldUpdateOperationsInput rules?: NexusGenScalars['Json'] | null; // Json shouldHideBasedOnWidth?: NexusGenInputs['BoolFieldUpdateOperationsInput'] | null; // BoolFieldUpdateOperationsInput @@ -2824,6 +3094,12 @@ export interface NexusGenInputs { update: NexusGenInputs['ModuleUpdateWithoutFinishInput']; // ModuleUpdateWithoutFinishInput! where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! }; + ModuleUpsertWithWhereUniqueWithoutOwnerInput: { + // input type + create: NexusGenInputs['ModuleCreateWithoutOwnerInput']; // ModuleCreateWithoutOwnerInput! + update: NexusGenInputs['ModuleUpdateWithoutOwnerInput']; // ModuleUpdateWithoutOwnerInput! + where: NexusGenInputs['ModuleWhereUniqueInput']; // ModuleWhereUniqueInput! + }; ModuleUpsertWithoutAttachmentToAppendParentsInput: { // input type create: NexusGenInputs['ModuleCreateWithoutAttachmentToAppendParentsInput']; // ModuleCreateWithoutAttachmentToAppendParentsInput! @@ -2854,6 +3130,11 @@ export interface NexusGenInputs { create: NexusGenInputs['ModuleCreateWithoutModuleTypeInput']; // ModuleCreateWithoutModuleTypeInput! update: NexusGenInputs['ModuleUpdateWithoutModuleTypeInput']; // ModuleUpdateWithoutModuleTypeInput! }; + ModuleUpsertWithoutModulesIOwnInput: { + // input type + create: NexusGenInputs['ModuleCreateWithoutModulesIOwnInput']; // ModuleCreateWithoutModulesIOwnInput! + update: NexusGenInputs['ModuleUpdateWithoutModulesIOwnInput']; // ModuleUpdateWithoutModulesIOwnInput! + }; ModuleUpsertWithoutProjectModulesInput: { // input type create: NexusGenInputs['ModuleCreateWithoutProjectModulesInput']; // ModuleCreateWithoutProjectModulesInput! @@ -2893,7 +3174,9 @@ export interface NexusGenInputs { moduleAttachments?: NexusGenInputs['ModuleAttachmentsListRelationFilter'] | null; // ModuleAttachmentsListRelationFilter moduleCategories?: NexusGenInputs['ModuleCategoryListRelationFilter'] | null; // ModuleCategoryListRelationFilter moduleType?: NexusGenInputs['ModuleTypeListRelationFilter'] | null; // ModuleTypeListRelationFilter + modulesIOwn?: NexusGenInputs['ModuleListRelationFilter'] | null; // ModuleListRelationFilter originalMarathonProductJson?: NexusGenInputs['JsonNullableFilter'] | null; // JsonNullableFilter + owner?: NexusGenInputs['ModuleWhereInput'] | null; // ModuleWhereInput ownerExternalId?: NexusGenInputs['StringNullableFilter'] | null; // StringNullableFilter partNumber?: NexusGenInputs['StringFilter'] | null; // StringFilter projectModules?: NexusGenInputs['ProjectModuleListRelationFilter'] | null; // ProjectModuleListRelationFilter @@ -2924,6 +3207,17 @@ export interface NexusGenInputs { not?: NexusGenInputs['NestedDateTimeFilter'] | null; // NestedDateTimeFilter notIn?: NexusGenScalars['DateTime'][] | null; // [DateTime!] }; + NestedDateTimeNullableFilter: { + // input type + equals?: NexusGenScalars['DateTime'] | null; // DateTime + gt?: NexusGenScalars['DateTime'] | null; // DateTime + gte?: NexusGenScalars['DateTime'] | null; // DateTime + in?: NexusGenScalars['DateTime'][] | null; // [DateTime!] + lt?: NexusGenScalars['DateTime'] | null; // DateTime + lte?: NexusGenScalars['DateTime'] | null; // DateTime + not?: NexusGenInputs['NestedDateTimeNullableFilter'] | null; // NestedDateTimeNullableFilter + notIn?: NexusGenScalars['DateTime'][] | null; // [DateTime!] + }; NestedEnumLocaleFilter: { // input type equals?: NexusGenEnums['Locale'] | null; // Locale @@ -3003,6 +3297,10 @@ export interface NexusGenInputs { notIn?: string[] | null; // [String!] startsWith?: string | null; // String }; + NullableDateTimeFieldUpdateOperationsInput: { + // input type + set?: NexusGenScalars['DateTime'] | null; // DateTime + }; NullableFloatFieldUpdateOperationsInput: { // input type decrement?: number | null; // Float @@ -4941,10 +5239,12 @@ export interface NexusGenObjects { }; List: { // root type + createdAt?: NexusGenScalars['DateTime'] | null; // DateTime externalId?: string | null; // String id: number; // Int! name?: string | null; // String projectId?: number | null; // Int + updatedAt?: NexusGenScalars['DateTime'] | null; // DateTime }; Module: { // root type @@ -5249,11 +5549,13 @@ export interface NexusGenFieldTypes { }; List: { // field return type + createdAt: NexusGenScalars['DateTime'] | null; // DateTime externalId: string | null; // String id: number; // Int! name: string | null; // String project: NexusGenRootTypes['Project'] | null; // Project projectId: number | null; // Int + updatedAt: NexusGenScalars['DateTime'] | null; // DateTime }; Module: { // field return type @@ -5286,7 +5588,9 @@ export interface NexusGenFieldTypes { moduleAttachedTo: NexusGenRootTypes['ModuleAttachments'][]; // [ModuleAttachments!]! moduleAttachments: NexusGenRootTypes['ModuleAttachments'][]; // [ModuleAttachments!]! moduleType: NexusGenRootTypes['ModuleType'][]; // [ModuleType!]! + modulesIOwn: NexusGenRootTypes['Module'][]; // [Module!]! originalMarathonProductJson: NexusGenScalars['Json'] | null; // Json + owner: NexusGenRootTypes['Module'] | null; // Module ownerExternalId: string | null; // String partNumber: string; // String! projectModules: NexusGenRootTypes['ProjectModule'][]; // [ProjectModule!]! @@ -5644,11 +5948,13 @@ export interface NexusGenFieldTypeNames { }; List: { // field return type name + createdAt: 'DateTime'; externalId: 'String'; id: 'Int'; name: 'String'; project: 'Project'; projectId: 'Int'; + updatedAt: 'DateTime'; }; Module: { // field return type name @@ -5681,7 +5987,9 @@ export interface NexusGenFieldTypeNames { moduleAttachedTo: 'ModuleAttachments'; moduleAttachments: 'ModuleAttachments'; moduleType: 'ModuleType'; + modulesIOwn: 'Module'; originalMarathonProductJson: 'Json'; + owner: 'Module'; ownerExternalId: 'String'; partNumber: 'String'; projectModules: 'ProjectModule'; @@ -6075,6 +6383,12 @@ export interface NexusGenArgTypes { skip?: number | null; // Int take?: number | null; // Int }; + modulesIOwn: { + // args + cursor?: NexusGenInputs['ModuleWhereUniqueInput'] | null; // ModuleWhereUniqueInput + skip?: number | null; // Int + take?: number | null; // Int + }; projectModules: { // args cursor?: NexusGenInputs['ProjectModuleWhereUniqueInput'] | null; // ProjectModuleWhereUniqueInput diff --git a/src/generated/schema.graphql b/src/generated/schema.graphql index 629ffc4..15d9c55 100644 --- a/src/generated/schema.graphql +++ b/src/generated/schema.graphql @@ -660,6 +660,17 @@ input DateTimeFilter { notIn: [DateTime!] } +input DateTimeNullableFilter { + equals: DateTime + gt: DateTime + gte: DateTime + in: [DateTime!] + lt: DateTime + lte: DateTime + not: NestedDateTimeNullableFilter + notIn: [DateTime!] +} + input EnumLocaleFieldUpdateOperationsInput { set: Locale } @@ -1036,17 +1047,21 @@ input JsonNullableFilter { } type List { + createdAt: DateTime externalId: String id: Int! name: String project: Project projectId: Int + updatedAt: DateTime } input ListCreateManyProjectInput { + createdAt: DateTime externalId: String id: Int name: String + updatedAt: DateTime } input ListCreateManyProjectInputEnvelope { @@ -1067,8 +1082,10 @@ input ListCreateOrConnectWithoutProjectInput { } input ListCreateWithoutProjectInput { + createdAt: DateTime externalId: String name: String + updatedAt: DateTime } input ListListRelationFilter { @@ -1081,15 +1098,19 @@ input ListScalarWhereInput { AND: [ListScalarWhereInput!] NOT: [ListScalarWhereInput!] OR: [ListScalarWhereInput!] + createdAt: DateTimeNullableFilter externalId: StringNullableFilter id: IntFilter name: StringNullableFilter projectId: IntNullableFilter + updatedAt: DateTimeNullableFilter } input ListUpdateManyMutationInput { + createdAt: NullableDateTimeFieldUpdateOperationsInput externalId: NullableStringFieldUpdateOperationsInput name: NullableStringFieldUpdateOperationsInput + updatedAt: NullableDateTimeFieldUpdateOperationsInput } input ListUpdateManyWithWhereWithoutProjectInput { @@ -1117,8 +1138,10 @@ input ListUpdateWithWhereUniqueWithoutProjectInput { } input ListUpdateWithoutProjectInput { + createdAt: NullableDateTimeFieldUpdateOperationsInput externalId: NullableStringFieldUpdateOperationsInput name: NullableStringFieldUpdateOperationsInput + updatedAt: NullableDateTimeFieldUpdateOperationsInput } input ListUpsertWithWhereUniqueWithoutProjectInput { @@ -1131,11 +1154,13 @@ input ListWhereInput { AND: [ListWhereInput!] NOT: [ListWhereInput!] OR: [ListWhereInput!] + createdAt: DateTimeNullableFilter externalId: StringNullableFilter id: IntFilter name: StringNullableFilter project: ProjectWhereInput projectId: IntNullableFilter + updatedAt: DateTimeNullableFilter } input ListWhereUniqueInput { @@ -1178,7 +1203,9 @@ type Module { moduleAttachedTo(cursor: ModuleAttachmentsWhereUniqueInput, skip: Int, take: Int): [ModuleAttachments!]! moduleAttachments(cursor: ModuleAttachmentsWhereUniqueInput, skip: Int, take: Int): [ModuleAttachments!]! moduleType(cursor: ModuleTypeWhereUniqueInput, skip: Int, take: Int): [ModuleType!]! + modulesIOwn(cursor: ModuleWhereUniqueInput, skip: Int, take: Int): [Module!]! originalMarathonProductJson: Json + owner: Module ownerExternalId: String partNumber: String! projectModules( @@ -1630,6 +1657,37 @@ input ModuleCreateManyFinishInputEnvelope { skipDuplicates: Boolean } +input ModuleCreateManyOwnerInput { + alwaysDisplay: Boolean + attachmentToAppendId: Int + bundleUrl: String + collectionId: Int! + createdAt: DateTime + defaultLeftExtensionId: Int + defaultRightExtensionId: Int + description: String + externalId: String + finishId: Int! + hasPegs: Boolean + id: Int + isEdge: Boolean + isExtension: Boolean + isMat: Boolean + isSubmodule: Boolean + isVirtualProduct: Boolean + originalMarathonProductJson: Json + partNumber: String! + rules: Json + shouldHideBasedOnWidth: Boolean + thumbnailUrl: String + updatedAt: DateTime +} + +input ModuleCreateManyOwnerInputEnvelope { + data: [ModuleCreateManyOwnerInput!] + skipDuplicates: Boolean +} + input ModuleCreateNestedManyWithoutAttachmentToAppendInput { connect: [ModuleWhereUniqueInput!] connectOrCreate: [ModuleCreateOrConnectWithoutAttachmentToAppendInput!] @@ -1665,6 +1723,13 @@ input ModuleCreateNestedManyWithoutFinishInput { createMany: ModuleCreateManyFinishInputEnvelope } +input ModuleCreateNestedManyWithoutOwnerInput { + connect: [ModuleWhereUniqueInput!] + connectOrCreate: [ModuleCreateOrConnectWithoutOwnerInput!] + create: [ModuleCreateWithoutOwnerInput!] + createMany: ModuleCreateManyOwnerInputEnvelope +} + input ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput { connect: ModuleWhereUniqueInput connectOrCreate: ModuleCreateOrConnectWithoutAttachmentToAppendParentsInput @@ -1701,6 +1766,12 @@ input ModuleCreateNestedOneWithoutModuleTypeInput { create: ModuleCreateWithoutModuleTypeInput } +input ModuleCreateNestedOneWithoutModulesIOwnInput { + connect: ModuleWhereUniqueInput + connectOrCreate: ModuleCreateOrConnectWithoutModulesIOwnInput + create: ModuleCreateWithoutModulesIOwnInput +} + input ModuleCreateNestedOneWithoutProjectModulesInput { connect: ModuleWhereUniqueInput connectOrCreate: ModuleCreateOrConnectWithoutProjectModulesInput @@ -1762,6 +1833,16 @@ input ModuleCreateOrConnectWithoutModuleTypeInput { where: ModuleWhereUniqueInput! } +input ModuleCreateOrConnectWithoutModulesIOwnInput { + create: ModuleCreateWithoutModulesIOwnInput! + where: ModuleWhereUniqueInput! +} + +input ModuleCreateOrConnectWithoutOwnerInput { + create: ModuleCreateWithoutOwnerInput! + where: ModuleWhereUniqueInput! +} + input ModuleCreateOrConnectWithoutProjectModulesInput { create: ModuleCreateWithoutProjectModulesInput! where: ModuleWhereUniqueInput! @@ -1790,8 +1871,9 @@ input ModuleCreateWithoutAttachmentToAppendInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1823,8 +1905,9 @@ input ModuleCreateWithoutAttachmentToAppendParentsInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1856,8 +1939,9 @@ input ModuleCreateWithoutCollectionInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1889,8 +1973,9 @@ input ModuleCreateWithoutDefaultLeftExtensionInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1922,8 +2007,9 @@ input ModuleCreateWithoutDefaultLeftExtensionParentsInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1955,8 +2041,9 @@ input ModuleCreateWithoutDefaultRightExtensionInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -1988,8 +2075,9 @@ input ModuleCreateWithoutDefaultRightExtensionParentsInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2021,8 +2109,9 @@ input ModuleCreateWithoutFinishInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2054,8 +2143,9 @@ input ModuleCreateWithoutModuleAttachedToInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2087,8 +2177,9 @@ input ModuleCreateWithoutModuleAttachmentsInput { moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2120,8 +2211,77 @@ input ModuleCreateWithoutModuleTypeInput { moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput + originalMarathonProductJson: Json + owner: ModuleCreateNestedOneWithoutModulesIOwnInput + partNumber: String! + projectModules: ProjectModuleCreateNestedManyWithoutModuleInput + rules: Json + shouldHideBasedOnWidth: Boolean + thumbnailUrl: String + updatedAt: DateTime +} + +input ModuleCreateWithoutModulesIOwnInput { + alwaysDisplay: Boolean + attachmentToAppend: ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents: ModuleCreateNestedManyWithoutAttachmentToAppendInput + bundleUrl: String + collection: CollectionCreateNestedOneWithoutModulesInput! + createdAt: DateTime + defaultLeftExtension: ModuleCreateNestedOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents: ModuleCreateNestedManyWithoutDefaultLeftExtensionInput + defaultRightExtension: ModuleCreateNestedOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents: ModuleCreateNestedManyWithoutDefaultRightExtensionInput + description: String + externalId: String + finish: FinishCreateNestedOneWithoutModulesInput! + hasPegs: Boolean + isEdge: Boolean + isExtension: Boolean + isMat: Boolean + isSubmodule: Boolean + isVirtualProduct: Boolean + moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput + moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput + moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput + moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + originalMarathonProductJson: Json + owner: ModuleCreateNestedOneWithoutModulesIOwnInput + partNumber: String! + projectModules: ProjectModuleCreateNestedManyWithoutModuleInput + rules: Json + shouldHideBasedOnWidth: Boolean + thumbnailUrl: String + updatedAt: DateTime +} + +input ModuleCreateWithoutOwnerInput { + alwaysDisplay: Boolean + attachmentToAppend: ModuleCreateNestedOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents: ModuleCreateNestedManyWithoutAttachmentToAppendInput + bundleUrl: String + collection: CollectionCreateNestedOneWithoutModulesInput! + createdAt: DateTime + defaultLeftExtension: ModuleCreateNestedOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents: ModuleCreateNestedManyWithoutDefaultLeftExtensionInput + defaultRightExtension: ModuleCreateNestedOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents: ModuleCreateNestedManyWithoutDefaultRightExtensionInput + description: String + externalId: String + finish: FinishCreateNestedOneWithoutModulesInput! + hasPegs: Boolean + isEdge: Boolean + isExtension: Boolean + isMat: Boolean + isSubmodule: Boolean + isVirtualProduct: Boolean + moduleAttachedTo: ModuleAttachmentsCreateNestedManyWithoutAttachmentInput + moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput + moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput + moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String partNumber: String! projectModules: ProjectModuleCreateNestedManyWithoutModuleInput rules: Json @@ -2154,8 +2314,9 @@ input ModuleCreateWithoutProjectModulesInput { moduleAttachments: ModuleAttachmentsCreateNestedManyWithoutModuleInput moduleCategories: ModuleCategoryCreateNestedManyWithoutModuleInput moduleType: ModuleTypeCreateNestedManyWithoutModuleInput + modulesIOwn: ModuleCreateNestedManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: String + owner: ModuleCreateNestedOneWithoutModulesIOwnInput partNumber: String! rules: Json shouldHideBasedOnWidth: Boolean @@ -2522,7 +2683,6 @@ input ModuleUpdateManyMutationInput { isSubmodule: BoolFieldUpdateOperationsInput isVirtualProduct: BoolFieldUpdateOperationsInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput rules: Json shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput @@ -2555,6 +2715,11 @@ input ModuleUpdateManyWithWhereWithoutFinishInput { where: ModuleScalarWhereInput! } +input ModuleUpdateManyWithWhereWithoutOwnerInput { + data: ModuleUpdateManyMutationInput! + where: ModuleScalarWhereInput! +} + input ModuleUpdateManyWithoutAttachmentToAppendInput { connect: [ModuleWhereUniqueInput!] connectOrCreate: [ModuleCreateOrConnectWithoutAttachmentToAppendInput!] @@ -2625,6 +2790,20 @@ input ModuleUpdateManyWithoutFinishInput { upsert: [ModuleUpsertWithWhereUniqueWithoutFinishInput!] } +input ModuleUpdateManyWithoutOwnerInput { + connect: [ModuleWhereUniqueInput!] + connectOrCreate: [ModuleCreateOrConnectWithoutOwnerInput!] + create: [ModuleCreateWithoutOwnerInput!] + createMany: ModuleCreateManyOwnerInputEnvelope + delete: [ModuleWhereUniqueInput!] + deleteMany: [ModuleScalarWhereInput!] + disconnect: [ModuleWhereUniqueInput!] + set: [ModuleWhereUniqueInput!] + update: [ModuleUpdateWithWhereUniqueWithoutOwnerInput!] + updateMany: [ModuleUpdateManyWithWhereWithoutOwnerInput!] + upsert: [ModuleUpsertWithWhereUniqueWithoutOwnerInput!] +} + input ModuleUpdateOneRequiredWithoutModuleAttachedToInput { connect: ModuleWhereUniqueInput connectOrCreate: ModuleCreateOrConnectWithoutModuleAttachedToInput @@ -2687,6 +2866,16 @@ input ModuleUpdateOneWithoutDefaultRightExtensionParentsInput { upsert: ModuleUpsertWithoutDefaultRightExtensionParentsInput } +input ModuleUpdateOneWithoutModulesIOwnInput { + connect: ModuleWhereUniqueInput + connectOrCreate: ModuleCreateOrConnectWithoutModulesIOwnInput + create: ModuleCreateWithoutModulesIOwnInput + delete: Boolean + disconnect: Boolean + update: ModuleUpdateWithoutModulesIOwnInput + upsert: ModuleUpsertWithoutModulesIOwnInput +} + input ModuleUpdateWithWhereUniqueWithoutAttachmentToAppendInput { data: ModuleUpdateWithoutAttachmentToAppendInput! where: ModuleWhereUniqueInput! @@ -2712,6 +2901,11 @@ input ModuleUpdateWithWhereUniqueWithoutFinishInput { where: ModuleWhereUniqueInput! } +input ModuleUpdateWithWhereUniqueWithoutOwnerInput { + data: ModuleUpdateWithoutOwnerInput! + where: ModuleWhereUniqueInput! +} + input ModuleUpdateWithoutAttachmentToAppendInput { alwaysDisplay: BoolFieldUpdateOperationsInput attachmentToAppendParents: ModuleUpdateManyWithoutAttachmentToAppendInput @@ -2735,8 +2929,9 @@ input ModuleUpdateWithoutAttachmentToAppendInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2768,8 +2963,9 @@ input ModuleUpdateWithoutAttachmentToAppendParentsInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2801,8 +2997,9 @@ input ModuleUpdateWithoutCollectionInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2834,8 +3031,9 @@ input ModuleUpdateWithoutDefaultLeftExtensionInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2867,8 +3065,9 @@ input ModuleUpdateWithoutDefaultLeftExtensionParentsInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2900,8 +3099,9 @@ input ModuleUpdateWithoutDefaultRightExtensionInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2933,8 +3133,9 @@ input ModuleUpdateWithoutDefaultRightExtensionParentsInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2966,8 +3167,9 @@ input ModuleUpdateWithoutFinishInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -2999,8 +3201,9 @@ input ModuleUpdateWithoutModuleAttachedToInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -3032,8 +3235,9 @@ input ModuleUpdateWithoutModuleAttachmentsInput { moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -3065,8 +3269,77 @@ input ModuleUpdateWithoutModuleTypeInput { moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput + originalMarathonProductJson: Json + owner: ModuleUpdateOneWithoutModulesIOwnInput + partNumber: StringFieldUpdateOperationsInput + projectModules: ProjectModuleUpdateManyWithoutModuleInput + rules: Json + shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput + thumbnailUrl: NullableStringFieldUpdateOperationsInput + updatedAt: DateTimeFieldUpdateOperationsInput +} + +input ModuleUpdateWithoutModulesIOwnInput { + alwaysDisplay: BoolFieldUpdateOperationsInput + attachmentToAppend: ModuleUpdateOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents: ModuleUpdateManyWithoutAttachmentToAppendInput + bundleUrl: NullableStringFieldUpdateOperationsInput + collection: CollectionUpdateOneRequiredWithoutModulesInput + createdAt: DateTimeFieldUpdateOperationsInput + defaultLeftExtension: ModuleUpdateOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents: ModuleUpdateManyWithoutDefaultLeftExtensionInput + defaultRightExtension: ModuleUpdateOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents: ModuleUpdateManyWithoutDefaultRightExtensionInput + description: NullableStringFieldUpdateOperationsInput + externalId: NullableStringFieldUpdateOperationsInput + finish: FinishUpdateOneRequiredWithoutModulesInput + hasPegs: BoolFieldUpdateOperationsInput + isEdge: BoolFieldUpdateOperationsInput + isExtension: BoolFieldUpdateOperationsInput + isMat: BoolFieldUpdateOperationsInput + isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput + moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput + moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput + moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput + moduleType: ModuleTypeUpdateManyWithoutModuleInput + originalMarathonProductJson: Json + owner: ModuleUpdateOneWithoutModulesIOwnInput + partNumber: StringFieldUpdateOperationsInput + projectModules: ProjectModuleUpdateManyWithoutModuleInput + rules: Json + shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput + thumbnailUrl: NullableStringFieldUpdateOperationsInput + updatedAt: DateTimeFieldUpdateOperationsInput +} + +input ModuleUpdateWithoutOwnerInput { + alwaysDisplay: BoolFieldUpdateOperationsInput + attachmentToAppend: ModuleUpdateOneWithoutAttachmentToAppendParentsInput + attachmentToAppendParents: ModuleUpdateManyWithoutAttachmentToAppendInput + bundleUrl: NullableStringFieldUpdateOperationsInput + collection: CollectionUpdateOneRequiredWithoutModulesInput + createdAt: DateTimeFieldUpdateOperationsInput + defaultLeftExtension: ModuleUpdateOneWithoutDefaultLeftExtensionParentsInput + defaultLeftExtensionParents: ModuleUpdateManyWithoutDefaultLeftExtensionInput + defaultRightExtension: ModuleUpdateOneWithoutDefaultRightExtensionParentsInput + defaultRightExtensionParents: ModuleUpdateManyWithoutDefaultRightExtensionInput + description: NullableStringFieldUpdateOperationsInput + externalId: NullableStringFieldUpdateOperationsInput + finish: FinishUpdateOneRequiredWithoutModulesInput + hasPegs: BoolFieldUpdateOperationsInput + isEdge: BoolFieldUpdateOperationsInput + isExtension: BoolFieldUpdateOperationsInput + isMat: BoolFieldUpdateOperationsInput + isSubmodule: BoolFieldUpdateOperationsInput + isVirtualProduct: BoolFieldUpdateOperationsInput + moduleAttachedTo: ModuleAttachmentsUpdateManyWithoutAttachmentInput + moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput + moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput + moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput partNumber: StringFieldUpdateOperationsInput projectModules: ProjectModuleUpdateManyWithoutModuleInput rules: Json @@ -3099,8 +3372,9 @@ input ModuleUpdateWithoutProjectModulesInput { moduleAttachments: ModuleAttachmentsUpdateManyWithoutModuleInput moduleCategories: ModuleCategoryUpdateManyWithoutModuleInput moduleType: ModuleTypeUpdateManyWithoutModuleInput + modulesIOwn: ModuleUpdateManyWithoutOwnerInput originalMarathonProductJson: Json - ownerExternalId: NullableStringFieldUpdateOperationsInput + owner: ModuleUpdateOneWithoutModulesIOwnInput partNumber: StringFieldUpdateOperationsInput rules: Json shouldHideBasedOnWidth: BoolFieldUpdateOperationsInput @@ -3138,6 +3412,12 @@ input ModuleUpsertWithWhereUniqueWithoutFinishInput { where: ModuleWhereUniqueInput! } +input ModuleUpsertWithWhereUniqueWithoutOwnerInput { + create: ModuleCreateWithoutOwnerInput! + update: ModuleUpdateWithoutOwnerInput! + where: ModuleWhereUniqueInput! +} + input ModuleUpsertWithoutAttachmentToAppendParentsInput { create: ModuleCreateWithoutAttachmentToAppendParentsInput! update: ModuleUpdateWithoutAttachmentToAppendParentsInput! @@ -3168,6 +3448,11 @@ input ModuleUpsertWithoutModuleTypeInput { update: ModuleUpdateWithoutModuleTypeInput! } +input ModuleUpsertWithoutModulesIOwnInput { + create: ModuleCreateWithoutModulesIOwnInput! + update: ModuleUpdateWithoutModulesIOwnInput! +} + input ModuleUpsertWithoutProjectModulesInput { create: ModuleCreateWithoutProjectModulesInput! update: ModuleUpdateWithoutProjectModulesInput! @@ -3206,7 +3491,9 @@ input ModuleWhereInput { moduleAttachments: ModuleAttachmentsListRelationFilter moduleCategories: ModuleCategoryListRelationFilter moduleType: ModuleTypeListRelationFilter + modulesIOwn: ModuleListRelationFilter originalMarathonProductJson: JsonNullableFilter + owner: ModuleWhereInput ownerExternalId: StringNullableFilter partNumber: StringFilter projectModules: ProjectModuleListRelationFilter @@ -3255,6 +3542,17 @@ input NestedDateTimeFilter { notIn: [DateTime!] } +input NestedDateTimeNullableFilter { + equals: DateTime + gt: DateTime + gte: DateTime + in: [DateTime!] + lt: DateTime + lte: DateTime + not: NestedDateTimeNullableFilter + notIn: [DateTime!] +} + input NestedEnumLocaleFilter { equals: Locale in: [Locale!] @@ -3334,6 +3632,10 @@ input NestedStringNullableFilter { startsWith: String } +input NullableDateTimeFieldUpdateOperationsInput { + set: DateTime +} + input NullableFloatFieldUpdateOperationsInput { decrement: Float divide: Float diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index 22bae05..35acd8e 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -3,7 +3,7 @@ import { Locale, Module, PrismaClient } from '@prisma/client'; import { ForbiddenError } from 'apollo-server'; import axios, { AxiosResponse } from 'axios'; import fetch from 'cross-fetch'; -import { helpers, image } from 'faker'; +import { helpers } from 'faker'; import { toNumber } from 'lodash'; import mime from 'mime'; import path from 'path'; @@ -13,12 +13,12 @@ import { env } from '../../env'; import { GetProductListingQuery, GetProductListingQueryVariables, + GetProductQuery, + GetProductQueryVariables, GetSpCategoryListingQuery, GetSpCollectionListingQuery, GetSpDrawerTypesListingQuery, - GetSpFinishListingQuery, - GetProductQuery, - GetProductQueryVariables + GetSpFinishListingQuery } from '../../generated/graphql'; import { makeError } from '../../utils/exception'; import { makeFile } from '../../utils/file'; @@ -740,18 +740,16 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { await db.collectionFinishes.createMany({ skipDuplicates: true, data: allFinishes - .map((dbFinish) => { - const collectionFinish = seed.collectionFinishes.find((x) => x.finish === dbFinish.slug); - const collection = collectionsForFinishes.find((x) => x.slug === collectionFinish?.collection); - - if (!collection) { - return undefined; - } - - return { - finishId: dbFinish.id, - collectionId: collection?.id || -1 - }; + .flatMap((dbFinish) => { + const collectionFinish = seed.collectionFinishes.filter((x) => x.finish === dbFinish.slug); + return collectionFinish.flatMap((collectionFinish) => { + const collection = collectionsForFinishes.filter((x) => x.slug === collectionFinish?.collection); + + return collection.flatMap((collection) => ({ + finishId: dbFinish.id, + collectionId: collection?.id || -1 + })); + }); }) .filter((x) => !!x) .map( @@ -922,8 +920,17 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { }); // Removes unwanted data out of "module" - const { finish, collection, drawerTypes, categories, otherFinishes, extensions, dimensions, ...moduleRest } = - module; + const { + finish, + collection, + drawerTypes, + categories, + otherFinishes, + extensions, + dimensions, + ownerExternalId, + ...moduleRest + } = module; let { partNumber } = module; @@ -988,7 +995,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (!skipDatabase) { const rules = existingProduct.rules ? mergeRules(module, existingProduct.rules as ModuleRules) : module; - await db.module.update({ + resultModule = await db.module.update({ where: { id: existingProduct.id }, data: { ...moduleRest, @@ -1125,6 +1132,34 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { return status; }; + const updateOwner = async ( + module: ModuleRules, + skipDatabase?: boolean + // eslint-disable-next-line @typescript-eslint/ban-types + ) => { + if (!db) { + throw new Error('db dependency was not provided'); + } + + const { externalId, ownerExternalId } = module; + if (!externalId || !ownerExternalId) return; + + if (!skipDatabase) { + await db.module.update({ + where: { externalId }, + data: { + owner: ownerExternalId + ? { + connect: { + externalId: ownerExternalId + } + } + : undefined + } + }); + } + }; + const syncProduct = async (skipDatabase?: boolean) => { if (!db) { throw new Error('db dependency was not provided'); @@ -1155,6 +1190,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log('Fetching products'); // eslint-disable-next-line @typescript-eslint/no-explicit-any const ignoredModules: any[] = []; + let extensions: string[] = []; // console.log(print(GET_PRODUCT_LISTING)); while (pageIndex >= 0) { console.log(`Asking for ${productsPerPage} products on page ${pageIndex + 1}`); @@ -1311,6 +1347,13 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } } + if (product.module.extensions?.options) { + extensions = [ + ...extensions, + ...product.module.extensions.options.filter((x) => !!x).map((x) => x as string) + ]; + } + if (product.alternative) { const alternativeStatus = await upsertProductModule( product.alternative, @@ -1341,6 +1384,11 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } else { throw makeError(`Could not upsert main product: ${productStatus}`, 'cannotUpsertMainProduct'); } + + // Update owners after the product has been created, because it must exist for it to be an owner, so we cannot do this before + if (product.alternative) { + await updateOwner(product.alternative, skipDatabase); + } } catch (err) { logging.error( err, @@ -1376,6 +1424,15 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } } + if (extensions && extensions.length > 0) { + await db.module.updateMany({ + where: { partNumber: { in: extensions } }, + data: { + isExtension: true + } + }); + } + if (ignoredModules && ignoredModules.length > 0) { try { const dir = path.join(__dirname, `./output`, '../../../../../marathon-logs'); @@ -1492,21 +1549,36 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { cart .filter((x) => x.projectModule.module.externalId) .forEach((cartItem) => { - items.push({ - oid: - (cartItem.projectModule.module.ownerExternalId as string) || - (cartItem.projectModule.module.externalId as string), - quantity: cartItem.quantity - }); + const oid = + (cartItem.projectModule.module.ownerExternalId as string) || + (cartItem.projectModule.module.externalId as string); + + const index = items.findIndex((x) => x.oid === oid); + if (index >= 0) { + items[index] = { ...items[index], quantity: (items[index].quantity || 0) + cartItem.quantity }; + } else { + items.push({ + oid, + quantity: cartItem.quantity, + tag: cartItem.projectModule.module.description as string + }); + } if (cartItem.children && cartItem.children.length > 0) { cartItem.children.forEach((cartItem) => { - items.push({ - oid: - (cartItem.projectModule.module.ownerExternalId as string) || - (cartItem.projectModule.module.externalId as string), - quantity: cartItem.quantity - }); + const oid = + (cartItem.projectModule.module.ownerExternalId as string) || + (cartItem.projectModule.module.externalId as string); + const index = items.findIndex((x) => x.oid === oid); + if (index >= 0) { + items[index] = { ...items[index], quantity: (items[index].quantity || 0) + cartItem.quantity }; + } else { + items.push({ + oid, + quantity: cartItem.quantity, + tag: cartItem.projectModule.module.description as string + }); + } }); } }); @@ -1549,6 +1621,7 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { throw makeError("Couldn't save list", 'createListCannotComplete'); } } catch (err) { + console.warn(err, `Error on Marathon server when creating cart`); throw err; } }; diff --git a/src/services/marathon/parsing/parseRules.ts b/src/services/marathon/parsing/parseRules.ts index 7a8f3dc..833135e 100644 --- a/src/services/marathon/parsing/parseRules.ts +++ b/src/services/marathon/parsing/parseRules.ts @@ -535,7 +535,7 @@ export const makeExtensions = ( isVirtualProduct: leftVirtualProduct, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: leftThumbnail, - isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules + isSubmodule: false, // Extensions CANNOT be submodules, they are already extensions hasPegs: false, // Not used for extensions shouldHideBasedOnWidth: false, // Not used for extensions alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) @@ -556,7 +556,7 @@ export const makeExtensions = ( isVirtualProduct: rightVirtualProduct, description: undefined, // They don't provide descriptions for nested modules thumbnailUrl: rightThumbnail, - isSubmodule: true, // Not really used for extensions modules but they are kinda like submodules + isSubmodule: false, // Extensions CANNOT be submodules, they are already extensions hasPegs: false, // Not used for extensions shouldHideBasedOnWidth: false, // Not used for extensions alwaysDisplay: false, // extensions don't show up as pegboard(this isn't even used) diff --git a/src/services/project.ts b/src/services/project.ts index bd88f33..5a2a781 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -1,6 +1,5 @@ import { PrismaClient } from '@prisma/client'; import { groupBy, values } from 'lodash'; -import { NexusGenObjects } from '../generated/nexus'; type ProjectServiceDependencies = { db?: PrismaClient; From e3ee8e19b2c85ccbbc71201abbdeaef80658ea14 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Thu, 28 Apr 2022 09:09:04 -0300 Subject: [PATCH 10/13] fix: fixes should hide when syncing --- src/services/marathon/parsing/parseRules.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/services/marathon/parsing/parseRules.ts b/src/services/marathon/parsing/parseRules.ts index 833135e..9c115c9 100644 --- a/src/services/marathon/parsing/parseRules.ts +++ b/src/services/marathon/parsing/parseRules.ts @@ -285,10 +285,7 @@ export const makeRulesFromMarathonModule = ( isSubmodule: marathonModule.isSubmodule || false, hasPegs: marathonModule.hasPegs || false, isMat: marathonModule.isMat || false, - shouldHideBasedOnWidth: - marathonModule.shouldHideBasedOnWidth !== undefined && marathonModule.shouldHideBasedOnWidth !== null - ? marathonModule.shouldHideBasedOnWidth - : true, + shouldHideBasedOnWidth: marathonModule.shouldHideBasedOnWidth || false, alwaysDisplay: marathonModule.alwaysDisplay || false, isEdge: marathonModule.isEdge || false, isExtension: false, // False in this case, we'll manually set to true on the method regarding extensions From 4089554b8e7bcbdea3fcdf02b2e8f496a5245313 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Thu, 28 Apr 2022 09:46:01 -0300 Subject: [PATCH 11/13] fix: comments logging files --- src/services/marathon/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index 35acd8e..52105b1 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -904,8 +904,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { console.log(`Upserting module ${module.partNumber} ${module.externalId}`); - const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); + //const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + //makeFile(dir, path.join(`jsons/${module.partNumber}.json`), module); const existingProduct = await db.module.findUnique({ where: { @@ -1216,8 +1216,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const module = productEdge?.node; - const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - makeFile(dir, path.join(`pre-rules/${productEdge?.node?.partNumber}.json`), module); + //const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + //makeFile(dir, path.join(`pre-rules/${productEdge?.node?.partNumber}.json`), module); // So we grab a finish Id if any(there should always be one) const finishId = @@ -1246,11 +1246,11 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { .filter((x) => !!x?.node) .flatMap((productEdge) => { try { - const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); - makeFile(dir, path.join(`marathon/${productEdge?.node?.partNumber}.json`), productEdge); + //const dir = path.join(__dirname, `./output`, '../../../../../marathon-module-jsons'); + //makeFile(dir, path.join(`marathon/${productEdge?.node?.partNumber}.json`), productEdge); // Casting since we filtered it previously const rules = makeRulesFromMarathonModule(productEdge?.node as MarathonModule); - makeFile(dir, path.join(`rules/${productEdge?.node?.partNumber}.json`), rules); + //makeFile(dir, path.join(`rules/${productEdge?.node?.partNumber}.json`), rules); return { ...rules, originalMarathonProductJson: productEdge @@ -1435,8 +1435,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (ignoredModules && ignoredModules.length > 0) { try { - const dir = path.join(__dirname, `./output`, '../../../../../marathon-logs'); - makeFile(dir, path.join(`ignored-modules.json`), { ignoredModules }); + //const dir = path.join(__dirname, `./output`, '../../../../../marathon-logs'); + //makeFile(dir, path.join(`ignored-modules.json`), { ignoredModules }); } catch { // Do nothing } From 48340ca140c137f79e34491c84a026355f2f87e2 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Mon, 2 May 2022 13:48:47 -0300 Subject: [PATCH 12/13] fix: fixes bundle path for module --- prisma/seedValues/seed.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prisma/seedValues/seed.json b/prisma/seedValues/seed.json index 209ddad..2594b12 100644 --- a/prisma/seedValues/seed.json +++ b/prisma/seedValues/seed.json @@ -3489,7 +3489,7 @@ }, { "partNumber": "04-AU-BIR-DIVIDER-H55", - "bundlePath": "modules/autograph/04-au-xxx-divider-h55/module", + "bundlePath": "modules/autograph/04-au-xxx-divider-h55/04-au-bir-divider-h55/module", "finish": "birch", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-BIR-DIVIDER-H55\",\r\n \"finishes\": [\r\n \"04-AU-WAL-DIVIDER-H55\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 55,\r\n \"inches\": \"2\\\" 5/32\"\r\n },\r\n \"depth\": {\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", @@ -3503,7 +3503,7 @@ }, { "partNumber": "04-AU-WAL-DIVIDER-H55", - "bundlePath": "modules/autograph/04-au-xxx-divider-h55/module", + "bundlePath": "modules/autograph/04-au-xxx-divider-h55/04-au-wal-divider-h55/module", "finish": "walnut", "collection": "autograph", "rules": "{\r\n \"partNumber\": \"04-AU-WAL-DIVIDER-H55\",\r\n \"finishes\": [\r\n \"04-AU-BIR-DIVIDER-H55\"\r\n ],\r\n \"dimensions\": {\r\n \"height\": {\r\n \"millimeters\": 55,\r\n \"inches\": \"2\\\" 5/32\"\r\n },\r\n \"depth\": {\r\n \"max\": {\r\n \"millimeters\": 589,\r\n \"inches\": \"23\\\" 3/16\"\r\n }\r\n }\r\n },\r\n \"rules\": {\r\n \"rotation\": 0,\r\n \"fullDepth\": true\r\n }\r\n}", From 2010d85701c0702d61ea1b760846529ddb17c40f Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Mon, 29 Jan 2024 15:44:15 -0500 Subject: [PATCH 13/13] feat: fix sync --- src/services/marathon/index.ts | 45 ++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/src/services/marathon/index.ts b/src/services/marathon/index.ts index 52105b1..211e643 100644 --- a/src/services/marathon/index.ts +++ b/src/services/marathon/index.ts @@ -35,6 +35,7 @@ import { GET_SP_DRAWER_TYPES_LISTING, GET_SP_FINISH_LISTING } from './queries'; +import fs from 'fs'; type MarathonServiceDependencies = { db?: PrismaClient; @@ -644,9 +645,8 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { if (thumbnailUrl) storageSyncQueue.push(thumbnailUrl); - await db.finish.update({ - where: { externalId: currentFinish.externalId }, - data: { + try { + console.dir({ slug: finishEdge?.node?.slug?.trim(), thumbnailUrl, translations: @@ -662,8 +662,31 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { } } : undefined - } - }); + }); + + await db.finish.update({ + where: { externalId: currentFinish.externalId }, + data: { + slug: finishEdge?.node?.slug?.trim(), + thumbnailUrl, + translations: + translationIds && translationIds.length > 0 + ? { + update: { + // Theoretically we should only have one id for locale+slug + where: { id: translationIds[0] }, + data: { + name: finishEdge?.node?.name?.trim(), + description: finishEdge?.node?.description?.trim() + } + } + } + : undefined + } + }); + } catch (ex) { + throw ex; + } await db.collectionFinishes.deleteMany({ where: { finish: { externalId: currentFinish.externalId } } }); } @@ -936,6 +959,18 @@ export const marathonService = ({ db }: MarathonServiceDependencies) => { const bundleUrl = seed.modules.find((x) => x.partNumber.toLowerCase() === partNumber.toLowerCase())?.bundlePath; + if (!bundleUrl) { + try { + fs.writeFileSync( + path.normalize(__dirname + `./../../../debug/${module.partNumber}.json`), + JSON.stringify(module, null, 2), + { flag: 'w', encoding: 'utf-8' } + ); + } catch { + // Do nothing + } + } + if (!existingProduct && partNumberProduct?.length > 0) { partNumber = `${partNumber}-${partNumberProduct.length}`; }