Skip to content

feat: onboarding backend - is_onboarded field and complete onboarding…#281

Open
tars919 wants to merge 8 commits intomainfrom
tarika/onboarding-backend
Open

feat: onboarding backend - is_onboarded field and complete onboarding…#281
tars919 wants to merge 8 commits intomainfrom
tarika/onboarding-backend

Conversation

@tars919
Copy link
Copy Markdown
Contributor

@tars919 tars919 commented Apr 4, 2026

… endpoint

Description

Adds backend support for the onboarding flow. Introduces an is_onboarded flag on the users table and a PUT /users/{id}/onboard endpoint that saves onboarding form data and marks the user as onboarded in a single transaction. For managers, this also creates a hotel record and links it to the user. Blocked on frontend for full end-to-end integration.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (code improvement without changing functionality)
  • Documentation update
  • Configuration/infrastructure change
  • Performance improvement
  • Test coverage improvement

Related Issue(s)

Closes #
Related to #

What Changed?

  • Added is_onboarded BOOLEAN NOT NULL DEFAULT FALSE column to users table via migration 20260404000004_add-is-onboarded-to-users.sql
  • Added IsOnboarded field to User and new OnboardUser model in internal/models/users.go
  • Added CompleteOnboarding repository method in internal/repository/users.go — uses a DB transaction to create a hotel (manager path) and update the user in one atomic operation
  • Updated all existing Scan calls in repository/users.go to include is_onboarded
  • Added CompleteOnboarding handler and updated UsersRepository interface in internal/handler/users.go
  • Registered PUT /users/:id/onboard route in internal/service/server.go
  • Added OnboardUser definition and PUT /users/{id}/onboard endpoint to swagger.yaml
  • Added CompleteOnboarding tests and updated mock in internal/handler/users_test.go

Testing & Validation

How this was tested

  1. Ran go build ./... — no errors
  2. Ran go test ./... — all tests pass
  3. Full end-to-end testing (frontend calling the endpoint) is deferred until both PRs are merged and npm run generate:api is run from clients/shared/

Screenshots/Recordings

Unfinished Work & Known Issues

  • None, this PR is complete and production-ready
  • The following items are intentionally deferred:
    • ***Frontend API hookup — OnboardingPage.tsx still uses console.log placeholders instead of calling the new endpoint. This will be done as a follow-on once both PRs are merged.


Notes & Nuances



  • Manager path creates a hotel record in the same transaction as the user update — if either fails, both are rolled back.
  • is_onboarded defaults to false for all existing users, so no existing functionality is affected.

Pre-Merge Checklist

Code Quality

  • Code follows the project's style guidelines and conventions
  • Self-review completed (I've reviewed my own code for obvious issues)
  • No debugging code, console logs, or commented-out code left behind
  • No merge conflicts with the base branch
  • Meaningful commit messages that explain the "why"

Testing & CI

  • All CI checks are passing
  • All new and existing tests pass locally
  • Test coverage hasn't decreased (or decrease is justified)
  • Linting passes without errors

Documentation

  • Code is self-documenting or includes helpful comments for complex logic
  • API documentation updated (if backend endpoints changed)
  • Type definitions are accurate and up-to-date

Reviewer Notes

  • Areas needing extra attention: ...
  • Questions for reviewers: ...

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

❌ Patch coverage is 0% with 137 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.12%. Comparing base (c055973) to head (74fba17).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
backend/internal/repository/users.go 0.00% 68 Missing ⚠️
clients/web/src/routeTree.gen.ts 0.00% 54 Missing ⚠️
backend/internal/handler/users.go 0.00% 14 Missing ⚠️
backend/internal/service/server.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##            main    #281      +/-   ##
========================================
+ Coverage   2.02%   9.12%   +7.09%     
========================================
  Files         82     131      +49     
  Lines       3064    5581    +2517     
  Branches      24      24              
========================================
+ Hits          62     509     +447     
- Misses      3002    5057    +2055     
- Partials       0      15      +15     
Flag Coverage Δ
backend 19.32% <0.00%> (?)
mobile 84.00% <ø> (ø)
web 0.62% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/internal/service/server.go 0.00% <0.00%> (ø)
backend/internal/handler/users.go 37.50% <0.00%> (ø)
clients/web/src/routeTree.gen.ts 0.00% <0.00%> (ø)
backend/internal/repository/users.go 0.00% <0.00%> (ø)

... and 53 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant