diff --git a/components/belonging/belongingService.js b/components/belonging/belongingService.js index 6fb3051..92cc733 100644 --- a/components/belonging/belongingService.js +++ b/components/belonging/belongingService.js @@ -109,14 +109,14 @@ const indexAllBelongings = async () => { isActive: belonging.isActive, // belongingCode: belonging.belongingCode, name: belonging.name, - category: belonging.category.englishName, - nativeCategory: belonging.category.nativeName, + category: belonging.category.englishName || '', + nativeCategory: belonging.category.nativeName || '', imageUrl: belonging.mainImageUrls[0] || '', - documents: belonging.documentUrls, - description: belonging.description, - unit: belonging.unit, - tags: combinedTags, - coordinates: belonging.location.coordinates, + documents: belonging.documentUrls || [] , + description: belonging.description || '', + unit: belonging.unit || '', + tags: combinedTags || '', + coordinates: belonging.location.coordinates || [0, 0], createdAt: Math.floor(new Date(belonging.createdAt).getTime() / 1000), // Store as timestamp in seconds }