(Optional) Step 13 Minimum nights stay

Purpose (Product)

  • Set the minimum stay requirement for short-term rentals to optimize occupancy and revenue while managing operational overhead.

  • This step only appears for landlords with host type "SHORT_TERM" or "BOTH", as it's specifically relevant for short-term rental strategies.

  • Helps balance guest convenience with operational efficiency by preventing single-night bookings that may not be profitable.

Default value: 3 nights if no previous value exists.

UX Flow (What the user sees)

  • A centered, large counter interface with a moon icon and current minimum nights value.

  • Plus/minus buttons on either side to adjust the value from 1 to 30 nights.

  • The counter has a rounded, pill-shaped design with hover effects and disabled states for boundary values.

  • Default value is 3 nights if no previous value exists.

![[Min Nights.png]]

System Flow (How it works)

sequenceDiagram
    actor Landlord
    participant Frontend as Web App (Next.js)
    participant Backend as API (NestJS)
    participant DB as Database

    %% Load existing value
    Frontend->>Frontend: Load property.minimumNights or default to 3

    %% User interaction
    Landlord->>Frontend: Click +/- buttons
    Frontend->>Frontend: Update local state (1-30 range)
    Frontend->>Frontend: Trigger form validation

    %% Submit minimum nights
    Landlord->>Frontend: Click "Next"
    Frontend->>Frontend: Validate form (minimumNights: 1-30, optional)

    Frontend->>Backend: PATCH /api/properties/{id} { propertyDetails: { minimumNights } }
    Backend->>DB: Update properties.propertyDetails.minimumNights
    Backend-->>Frontend: 200 OK (updated property)
    Frontend->>Frontend: Advance to next step

Data Touched

Table
Field
Type
Notes

properties

propertyDetails.minimumNights

number (optional)

Range: 1–30. Default: 3 if not previously set

Validation rules:

  • Minimum: 1 night

  • Maximum: 30 nights

  • Field is optional (can be null/undefined)

APIs Called

PATCH /api/properties/{id}

  • Method: PATCH

  • Payload: { propertyDetails: { minimumNights: number } }

  • Response: Updated property object

  • Idempotent: Yes

  • Retries: Standard axios retry logic

QA Checklist

Basic functionality:

Data persistence:

Host type logic:

Error handling:

UX/UI: