Добавлены новые поля в тип LaximoFulltextDetail и обновлен резолвер для маппинга данных, включая обработку отсутствующих полей. Это улучшает соответствие данных GraphQL схеме и обеспечивает более полное представление деталей.
This commit is contained in:
@ -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) {
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user