Добавлены новые поля в интерфейс LaximoVehicleSearchResult для расширения функциональности поиска автомобилей. Обновлен резолвер для обработки неавторизованных пользователей, возвращая пустой массив вместо ошибки. Это улучшает взаимодействие с API и пользовательский опыт.

This commit is contained in:
Bivekich
2025-07-02 16:56:07 +03:00
parent 80b699ff4e
commit fd78900ac5
2 changed files with 21 additions and 8 deletions

View File

@ -1152,7 +1152,8 @@ export const resolvers = {
try {
const actualContext = context || getContext()
if (!actualContext.clientId) {
throw new Error('Клиент не авторизован')
// Для неавторизованных пользователей возвращаем пустой массив
return []
}
// Удаляем префикс client_ если он есть

View File

@ -86,6 +86,25 @@ export interface LaximoVehicleSearchResult {
engine: string
notes?: string
ssd?: string
transmission?: string
date?: string
manufactured?: string
framecolor?: string
trimcolor?: string
engine_info?: string
engineno?: string
market?: string
prodRange?: string
prodPeriod?: string
destinationregion?: string
creationregion?: string
datefrom?: string
dateto?: string
modelyearfrom?: string
modelyearto?: string
options?: string
description?: string
grade?: string
}
export interface LaximoVehicleInfo {
@ -1699,7 +1718,6 @@ class LaximoService {
// Дополнительные атрибуты из документации Laximo
grade: attributeMap.get('grade') || undefined,
transmission: attributeMap.get('transmission') || undefined,
doors: attributeMap.get('doors') || undefined,
creationregion: attributeMap.get('creationregion') || undefined,
destinationregion: attributeMap.get('destinationregion') || undefined,
date: attributeMap.get('date') || undefined,
@ -1708,12 +1726,6 @@ class LaximoService {
trimcolor: attributeMap.get('trimcolor') || undefined,
datefrom: attributeMap.get('datefrom') || undefined,
dateto: attributeMap.get('dateto') || undefined,
frame: attributeMap.get('frame') || undefined,
frames: attributeMap.get('frames') || undefined,
framefrom: attributeMap.get('framefrom') || undefined,
frameto: attributeMap.get('frameto') || undefined,
engine1: attributeMap.get('engine1') || undefined,
engine2: attributeMap.get('engine2') || undefined,
engine_info: attributeMap.get('engine_info') || undefined,
engineno: attributeMap.get('engineno') || undefined,
options: attributeMap.get('options') || undefined,