Skip to content

Add users and link them to hotels #79

Closed

Description

@selvarajuv

Problem

The API has no idea who is calling it. There's no users table, so we can't sign anyone in, limit what they see, or record who made a decision.

Goal

Users exist in the database, each with a Google identity, and each can be linked to the hotels they work for.

Scope

  • A users table: Google account ID (unique), email, name, created at, last signed in at.
  • A link table between users and hotels, so a hotel can have several users and a user can belong to more than one hotel later. A user with no hotel is allowed (they've just signed up).
  • Models, repository and services through every layer, following the Widget slice.
  • An Alembic migration that applies and rolls back.
  • A command to link a user to a hotel by email (e.g. just link-user <email> <hotel_id>), until there's a way to do it in the app.
  • Not in scope: passwords; sign-in is Google only.

Considerations

  • Identify users by Google's account ID (sub), not their email: emails can change.
  • Keep the link table simple (user, hotel, created at). Roles can be added later if needed.

Acceptance criteria

  • The migration upgrades and downgrades cleanly.
  • A user can be created, found by Google account ID, and linked to a hotel.
  • Linking the same user to the same hotel twice doesn't create a duplicate.
  • Tests cover the repository and service.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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