Добавлено новое поле attributes в интерфейс LaximoVehicleSearchResult и тип GraphQL для улучшения структуры данных. Реализован маппинг ключей к человеко-читаемым названиям в классе LaximoService, что улучшает читаемость и удобство работы с атрибутами автомобилей.
This commit is contained in:
@ -1368,6 +1368,7 @@ export const typeDefs = gql`
|
||||
options: String
|
||||
description: String
|
||||
grade: String
|
||||
attributes: [LaximoVehicleAttribute!]!
|
||||
}
|
||||
|
||||
type LaximoVehicleInfo {
|
||||
|
@ -105,6 +105,7 @@ export interface LaximoVehicleSearchResult {
|
||||
options?: string
|
||||
description?: string
|
||||
grade?: string
|
||||
attributes: LaximoVehicleAttribute[]
|
||||
}
|
||||
|
||||
export interface LaximoVehicleInfo {
|
||||
@ -1737,6 +1738,45 @@ class LaximoService {
|
||||
prodPeriod: attributeMap.get('prodPeriod') || undefined,
|
||||
carpet_color: attributeMap.get('carpet_color') || undefined,
|
||||
seat_combination_code: attributeMap.get('seat_combination_code') || undefined,
|
||||
attributes: Array.from(attributeMap.entries()).map(([key, value]) => {
|
||||
// Маппинг ключей к человеко-читаемым названиям
|
||||
const keyNameMap: Record<string, string> = {
|
||||
'model': 'Модель',
|
||||
'MVS': 'Код в каталоге',
|
||||
'MVSDesc': 'Описание',
|
||||
'specialVersion': 'Версия',
|
||||
'engine': 'Двигатель',
|
||||
'variant': 'Исполнение',
|
||||
'transmission': 'КПП',
|
||||
'bodytype': 'Тип кузова',
|
||||
'year': 'Год',
|
||||
'manufactured': 'Год выпуска',
|
||||
'date': 'Дата',
|
||||
'market': 'Рынок',
|
||||
'grade': 'Класс',
|
||||
'framecolor': 'Цвет кузова',
|
||||
'trimcolor': 'Цвет салона',
|
||||
'engine_info': 'Информация о двигателе',
|
||||
'engineno': 'Номер двигателя',
|
||||
'options': 'Опции',
|
||||
'description': 'Описание',
|
||||
'notes': 'Примечания',
|
||||
'creationregion': 'Регион производства',
|
||||
'destinationregion': 'Регион назначения',
|
||||
'datefrom': 'Дата с',
|
||||
'dateto': 'Дата по',
|
||||
'modelyearfrom': 'Модельный год с',
|
||||
'modelyearto': 'Модельный год по',
|
||||
'prodRange': 'Диапазон производства',
|
||||
'prodPeriod': 'Период производства'
|
||||
};
|
||||
|
||||
return {
|
||||
key,
|
||||
name: keyNameMap[key] || key,
|
||||
value
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
console.log('🚗 Найден автомобиль:', {
|
||||
|
Reference in New Issue
Block a user