diff --git a/src/lib/graphql/resolvers.ts b/src/lib/graphql/resolvers.ts index d02aedd..c693173 100644 --- a/src/lib/graphql/resolvers.ts +++ b/src/lib/graphql/resolvers.ts @@ -1927,6 +1927,29 @@ export const resolvers = { result.details.length ) } + + // Мапим данные для GraphQL схемы, добавляя отсутствующие поля + if (result) { + return { + ...result, + details: result.details.map(detail => ({ + detailid: null, // Полнотекстовый поиск не возвращает detailid + oem: detail.oem, + formattedoem: detail.oem, // Используем oem как formattedoem + name: detail.name, + brand: detail.brand || null, + description: detail.description || null, + codeonimage: null, + code: null, + note: null, + filter: null, + parttype: null, + price: null, + availability: null, + attributes: [] + })) + } + } return result } catch (err) { diff --git a/src/lib/graphql/typeDefs.ts b/src/lib/graphql/typeDefs.ts index ba428e3..ee08aa8 100644 --- a/src/lib/graphql/typeDefs.ts +++ b/src/lib/graphql/typeDefs.ts @@ -1473,10 +1473,20 @@ export const typeDefs = gql` } type LaximoFulltextDetail { + detailid: String oem: String! + formattedoem: String name: String! brand: String description: String + codeonimage: String + code: String + note: String + filter: String + parttype: String + price: String + availability: String + attributes: [LaximoDetailAttribute!] } # Типы для Doc FindOEM