Note new amenities and seed randomization

This commit is contained in:
Tero Halla-aho 2025-11-27 11:05:26 +02:00
parent 35f2551c6b
commit 4d5c7eedf8
2 changed files with 15 additions and 1 deletions

View file

@ -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`.

View file

@ -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);