Skip to content

Fix onboarding create/update flow and validation - #30

Open
Linda-riziki wants to merge 1 commit into
mainfrom
onboarding-upsert-validation
Open

Fix onboarding create/update flow and validation#30
Linda-riziki wants to merge 1 commit into
mainfrom
onboarding-upsert-validation

Conversation

@Linda-riziki

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes the onboarding flow so users can safely complete onboarding multiple times without causing server errors. Instead of always creating a new user_goals record, the API now creates a record on the first submission and updates the existing record on subsequent submissions.

What changed

  • Replaced the insert-only onboarding logic with an authenticated create-or-update flow keyed by the authenticated user.

  • Added shared server-side validation for all onboarding fields.

  • Improved API responses by returning appropriate 400 and 401 errors instead of generic 500 errors for invalid or unauthorized requests.

  • Preserved existing onboarding completion behavior and SOC binding semantics.

  • Updated the database logic to correctly handle onboarding updates for existing users.

  • Added automated tests covering:

    • First onboarding completion
    • Repeat onboarding completion
    • Partial onboarding updates
    • Invalid onboarding payloads
    • Unauthorized requests

Verification

  • Ran the application locally to ensure the project starts successfully.
  • Ran the test suite:
npm test

Result:

  • ✅ 1 test file passed
  • ✅ 5/5 tests passed

These tests verify that onboarding is idempotent, validates incoming data correctly, and returns appropriate responses for authorized and unauthorized requests.

If you'd like, I can also make it match the style used by the repository's previous PRs.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
skills-sync Ready Ready Preview Aug 3, 2026 2:54pm

@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for skillsyncglobal ready!

Name Link
🔨 Latest commit c399f1b
🔍 Latest deploy log https://app.netlify.com/projects/skillsyncglobal/deploys/6a70ab89c35bbc000814a5be
😎 Deploy Preview https://deploy-preview-30--skillsyncglobal.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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