Skip to content

Let a new user set up their hotel #82

Open

Description

@selvarajuv

Blocked by: #79, #80

Problem

Anyone can sign up with Google, but a new user has no hotel, so there's nothing for them to see. Today a hotel, its city and its room types can only be created by calling the API by hand, which a hotel manager can't do.

Goal

After signing up, a user without a hotel sets one up in a few steps and lands in the app as that hotel's first user.

Scope

  • An onboarding endpoint (e.g. POST /onboarding/hotel) that, in one transaction, creates the hotel, its room type and the link between the signed-in user and the hotel.
  • The details asked for:
    • Hotel name and location (city).
    • Total rooms.
    • One room type ("Standard") with its room count and normal nightly rate.
  • City: pick an existing city, or create a new one from a search, filling in timezone, coordinates and nearest airport automatically.
  • GET /auth/me says whether the user still needs to set up a hotel, so the frontend knows where to send them.
  • After setup, start the first events and weather backfill for the new hotel.
  • Not in scope: the onboarding screens (frontend), inviting other users to a hotel, more than one room type, and trials or billing.

Considerations

  • A city's timezone and coordinates drive which nights and which events belong to the hotel; getting them wrong silently breaks recommendations. Fill them from a geocoding lookup rather than asking the user to type them.
  • Two people from the same hotel could each create it. Until invites exist, the second person should contact us to be linked rather than create a duplicate.
  • Validate the room count against total rooms and require a positive rate.
  • Decide whether a user can set up a second hotel; one is enough for now.

Acceptance criteria

  • A newly signed-up user can create a hotel and is linked to it as its first user.
  • If any step fails, nothing is saved.
  • GET /auth/me shows that setup is needed before, and not after.
  • The new hotel's city has a timezone and coordinates without the user typing them.
  • The first events and weather backfill starts for the new hotel.
  • Tests cover success, validation errors and the rollback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    authUsers, login and logout, protected routesfeatureIntroduces a new and complete feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions