Removed number from property.
All checks were successful
thehideout/TheHideout-API/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-01-02 23:36:25 +00:00
parent f39c8c1981
commit 86bd0b7fc8

View File

@ -92,6 +92,15 @@ export async function storeProperties(env, properties) {
export async function transformSmoobuProperty(env, property) { export async function transformSmoobuProperty(env, property) {
console.log("Transforming property:", property.id); console.log("Transforming property:", property.id);
let street = property.location?.street || "";
// Remove leading number and whitespace if present
street = street.replace(/^\d+\s*/, "");
// Split by commas and join with newlines
street = street
.split(",")
.map((s) => s.trim())
.join("\n");
return { return {
smoobuId: property.id, smoobuId: property.id,
name: property.name || "Unknown Property", name: property.name || "Unknown Property",
@ -107,7 +116,7 @@ export async function transformSmoobuProperty(env, property) {
queenSizeBeds: property.rooms?.queenSizeBeds || 0, queenSizeBeds: property.rooms?.queenSizeBeds || 0,
kingSizeBeds: property.rooms?.kingSizeBeds || 0, kingSizeBeds: property.rooms?.kingSizeBeds || 0,
address: property.location address: property.location
? `${property.location.street || ""}\n${property.location.city || ""}\n${ ? `${street || ""}\n${property.location.city || ""}\n${
property.location.zip || "" property.location.zip || ""
}`.trim() }`.trim()
: "Unknown Address", : "Unknown Address",