feat: replace mock user helpers with Prisma-backed profile API#107
Open
Yilkash wants to merge 1 commit into
Open
feat: replace mock user helpers with Prisma-backed profile API#107Yilkash wants to merge 1 commit into
Yilkash wants to merge 1 commit into
Conversation
- Add firstName, lastName, bio, avatar fields to User model in Prisma schema - Add LearnerProfile model with display name, country, timezone, languages, skill level, interests, goals, and visibility/consent controls - Add OnboardingState model tracking profile completion, email verification, wallet connection, session booking, credential earning, and consent - Create user.service.ts with Prisma-backed methods: - findUserById with profile, onboarding, and profile completion - updateUserProfile with audit logging - updateUserProfileData for LearnerProfile upsert - validatePassword using bcrypt.compare - updateUserPassword using bcrypt hash - updateUserWallet with onboarding state update - getPublicProfile with consent-aware visibility check - getProfileCompletion and getOnboardingState - Update UserController to use service instead of mock helpers - Add audit logging for PROFILE_UPDATED, PASSWORD_CHANGED, WALLET_UPDATED - Add public profile read respecting LearnerProfile visibility - Return profileCompletion and onboardingState in user responses - Add GET /me/profile route for extended profile - Update tests to mock Prisma instead of spying on private methods - All 318 tests pass, TypeScript compiles cleanly Closes: learnault#85
Yilkash
force-pushed
the
replace-mock-users-85
branch
from
July 20, 2026 07:07
557fd40 to
60df40e
Compare
3m1n3nc3
requested changes
Jul 20, 2026
3m1n3nc3
left a comment
Contributor
There was a problem hiding this comment.
Please sync your fork and resolve conflicts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces hard-coded mock user helpers in
UserControllerwith real Prisma queries. Adds profile fields to theUsermodel, aLearnerProfilemodel for public/private profile data with consent controls, and anOnboardingStatemodel for tracking user onboarding progress.Changes
Prisma Schema
firstName,lastName,bio,avatarcolumnsdisplayName,country,timezone,languages,skillLevel,interests,goals,visibility(public/private/mentor_only),consentGivenprofileComplete,emailVerified,walletConnected,firstSessionBooked,firstCredentialEarned,consentProvided,completedSteps,currentStep,dismissedServices
findUserById— fetches user with profile, onboarding, and profile completionupdateUserProfile— Prisma update with computed completionupdateUserProfileData— upserts LearnerProfilevalidatePassword— usesbcrypt.compareupdateUserPassword— usesbcrypt.hashupdateUserWallet— updates wallet + marks onboarding stepgetPublicProfile— consent-aware visibility checkgetProfileCompletion,getOnboardingStateController
findUserById,updateUserProfile,updateUserWallet,validatePassword,updateUserPassword)user.servicemethodsPROFILE_UPDATED,PASSWORD_CHANGED,WALLET_UPDATEDgetUserByIdreturns consent-aware public profile (respectsLearnerProfile.visibility)profileCompletionandonboardingstateRoutes
GET /me/profilefor extended profile readTests
user.controller.test.tsto mock Prisma directly (followingauth.controller.test.tspattern)Verification
npx tsc --noEmit— 0 errorspnpm test— 318 tests pass across 20 test filesCloses: #85