diff --git a/app/owner/properties/add/page.js b/app/owner/properties/add/page.js index 6336d76..fc408a0 100644 --- a/app/owner/properties/add/page.js +++ b/app/owner/properties/add/page.js @@ -648,19 +648,19 @@ const handleMapClick = async (coords) => { const detailsJSON = JSON.stringify(details); const propInfo = { - cordsX: formData.lat ? String(formData.lat) : '', - cordsY: formData.lng ? String(formData.lng) : '', - images: uploadedImagePaths, - address: `${formData.city} - ${formData.district} - ${formData.address}`.trim(), - description: formData.description || '', - numberOfBathRooms: formData.bathrooms || 0, - numberOfRooms: formData.bedrooms || 0, - numberOfBedRooms: formData.bedrooms || 0, - space: parseFloat(formData.space) || 0, - detailsJSON, - buildingType: buildingTypeMap[formData.propertyType] ?? BuildingType.APARTMENT, - status: 0, - propertyType: formData.furnished ? RentPropertyCondition.WITH_FURNITURE : RentPropertyCondition.WITHOUT_FURNITURE, + CordsX: formData.lat ? String(formData.lat) : '', + CordsY: formData.lng ? String(formData.lng) : '', + Images: uploadedImagePaths, + Address: `${formData.city} - ${formData.district} - ${formData.address}`.trim(), + Description: formData.description || '', + NumberOfBathRooms: formData.bathrooms || 0, + NumberOfRooms: formData.bedrooms || 0, + NumberOfBedRooms: formData.bedrooms || 0, + Space: parseFloat(formData.space) || 0, + DetailsJSON: detailsJSON, + BuildingType: buildingTypeMap[formData.propertyType] ?? BuildingType.APARTMENT, + Status: 0, + PropertyType: formData.furnished ? RentPropertyCondition.WITH_FURNITURE : RentPropertyCondition.WITHOUT_FURNITURE, }; try { @@ -677,15 +677,15 @@ const handleMapClick = async (coords) => { } else { const rentTypeMap = { daily: RentType.DAILY, monthly: RentType.MONTHLY, both: RentType.MONTHLY }; const rentBody = { - propertyInformation: propInfo, - deposit: parseFloat(formData.deposit) || 0, - monthlyRent: parseFloat(formData.monthlyPrice) || 0, - dailyRent: parseFloat(formData.dailyPrice) || 0, - rating: 1, - currencyId: selectedCurrencyId, - rentType: rentTypeMap[formData.offerType] ?? RentType.MONTHLY, - type: formData.furnished ? RentPropertyType.FURNISHED : RentPropertyType.UNFURNISHED, - allowedPaymentPeriod: '01:00:00:00', + PropertyInformation: propInfo, + Deposit: parseFloat(formData.deposit) || 0, + MonthlyRent: parseFloat(formData.monthlyPrice) || 0, + DailyRent: parseFloat(formData.dailyPrice) || 0, + Rating: 1, + CurrencyId: selectedCurrencyId, + RentType: rentTypeMap[formData.offerType] ?? RentType.MONTHLY, + Type: formData.furnished ? RentPropertyType.FURNISHED : RentPropertyType.UNFURNISHED, + AllowedPaymentPeriod: '01:00:00:00', }; const payload = { rentPropertyDto: rentBody }; console.log('[AddProperty] Rent payload:', JSON.stringify(payload, null, 2)); diff --git a/app/owner/properties/page.js b/app/owner/properties/page.js index d1f2f81..f71654a 100644 --- a/app/owner/properties/page.js +++ b/app/owner/properties/page.js @@ -1270,46 +1270,47 @@ export default function OwnerPropertiesPage() { }; const detailsJSON = JSON.stringify(details); - const payload = { - propertyInformation: { - cordsX: raw.propertyInformation?.cordsX || "", - cordsY: raw.propertyInformation?.cordsY || "", - address: + const editBody = { + PropertyInformation: { + CordsX: raw.propertyInformation?.cordsX || "", + CordsY: raw.propertyInformation?.cordsY || "", + Address: updatedProperty.address || raw.propertyInformation?.address || "", - description: + Description: updatedProperty.description || raw.propertyInformation?.description || "", - numberOfBathRooms: + NumberOfBathRooms: updatedProperty.bathrooms || raw.propertyInformation?.numberOfBathRooms || 0, - numberOfRooms: updatedProperty.bedrooms || 0, - numberOfBedRooms: + NumberOfRooms: updatedProperty.bedrooms || 0, + NumberOfBedRooms: updatedProperty.bedrooms || raw.propertyInformation?.numberOfBedRooms || 0, - space: + Space: parseFloat(updatedProperty.area) || raw.propertyInformation?.space || 0, - detailsJSON, - buildingType: buildingTypeMap[updatedProperty.propertyType] ?? 0, - status: updatedProperty.status === "available" ? 0 : 1, - propertyType: updatedProperty.furnished ? 0 : 1, - images: raw.propertyInformation?.images || [], + DetailsJSON: detailsJSON, + BuildingType: buildingTypeMap[updatedProperty.propertyType] ?? 0, + Status: updatedProperty.status === "available" ? 0 : 1, + PropertyType: updatedProperty.furnished ? 0 : 1, + Images: raw.propertyInformation?.images || [], }, - deposit: parseFloat(updatedProperty.deposit) || raw.deposit || 0, - monthlyRent: + Deposit: parseFloat(updatedProperty.deposit) || raw.deposit || 0, + MonthlyRent: parseFloat(updatedProperty.monthlyPrice) || raw.monthlyRent || 0, - dailyRent: + DailyRent: parseFloat(updatedProperty.dailyPrice) || raw.dailyRent || 0, - rating: 1, - currencyId: updatedProperty.currencyId || raw.currencyId || 1, - rentType: rentTypeMap[updatedProperty.rentType] ?? 0, - type: updatedProperty.furnished ? 0 : 1, - allowedPaymentPeriod: "01:00:00:00", + Rating: 1, + CurrencyId: updatedProperty.currencyId || raw.currencyId || 1, + RentType: rentTypeMap[updatedProperty.rentType] ?? 0, + Type: updatedProperty.furnished ? 0 : 1, + AllowedPaymentPeriod: "01:00:00:00", }; + const payload = { rentPropertyDto: editBody }; await editRentProperty(updatedProperty.id, payload); }