From 4d5c7eedf834727d1c650f276eafd0953093d9a7 Mon Sep 17 00:00:00 2001 From: Tero Halla-aho Date: Thu, 27 Nov 2025 11:05:26 +0200 Subject: [PATCH] Note new amenities and seed randomization --- PROGRESS.md | 1 + prisma/seed.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/PROGRESS.md b/PROGRESS.md index 4dbd14d..c5e0d70 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -60,6 +60,7 @@ - Price hint now stored in euros (schema field `priceHintPerNightEuros`); Prisma migration added to convert from cents, seeds and API/UI updated, and build now runs `prisma generate` automatically. - Listing creation amenities UI improved with toggle cards and EV button group. - Mermaid docs fixed: all sequence diagrams declare their participants and avoid “->” inside message text; the listing creation diagram message was rewritten to prevent parse errors. Use mermaid.live or browser console to debug future syntax issues (errors flag the offending line/column). +- New amenities added: kitchen, dishwasher, washing machine, barbecue; API/UI/i18n updated and seeds randomized to populate missing prices/amenities. Prisma migration `20250210_more_amenities` applied to shared DB; registry pull secret added to k8s Deployment to avoid image pull errors in prod. To resume: 1) If desired, render diagrams locally: PlantUML in `docs/plantuml`, draw.io in `docs/drawio`. diff --git a/prisma/seed.js b/prisma/seed.js index a4bf11d..c387765 100644 --- a/prisma/seed.js +++ b/prisma/seed.js @@ -134,7 +134,7 @@ async function main() { }, }); - const listings = [ + let listings = [ { slug: SAMPLE_SLUG, isSample: true, @@ -539,6 +539,19 @@ async function main() { }, ]; + // Fill in any missing amenities/prices with reasonable defaults + const randBool = (p = 0.5) => Math.random() < p; + listings = listings.map((item) => ({ + ...item, + priceHintPerNightEuros: + item.priceHintPerNightEuros ?? + Math.round(Math.random() * (220 - 90) + 90), + hasKitchen: item.hasKitchen ?? randBool(0.9), + hasDishwasher: item.hasDishwasher ?? randBool(0.6), + hasWashingMachine: item.hasWashingMachine ?? randBool(0.6), + hasBarbecue: item.hasBarbecue ?? randBool(0.5), + })); + for (const item of listings) { const existing = await prisma.listingTranslation.findFirst({ where: { slug: item.slug }, select: { listingId: true } }); const imageCreates = buildImageCreates(item);