Skip to content

feat(profile): add learner public/private profile schema - #119

Merged
3m1n3nc3 merged 1 commit into
learnault:mainfrom
Ezeh20:profile-schema
Jul 30, 2026
Merged

feat(profile): add learner public/private profile schema#119
3m1n3nc3 merged 1 commit into
learnault:mainfrom
Ezeh20:profile-schema

Conversation

@Ezeh20

@Ezeh20 Ezeh20 commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Closes #83

Adds a LearnerProfile model separate from User's private/account fields, with a modeled visibility system and tiered serializers.

  • Schema: LearnerProfile (1:1 with User) — displayName, bio, avatarUrl, country, timezone, languages[], level, interests[], goals[], visibility. Indexed on country, level, visibility (the consented/searchable fields). Account status/verification remain on User, not duplicated here.

  • Visibility: single ranked visibility field (private < employer < public, VISIBILITY_RANK in src/types/profile.types.ts)

  • Serializers (src/services/profile-serializer.ts, pure functions, no I/O):

    • toOwnerProfile — full record + computed completion, always (ignores visibility — it's the owner's own view)
    • toEmployerProfile — full field set if visibility >= employer, else { id, visible: false }
    • toPublicProfile — narrower public-safe subset if visibility === public, else redacted
    • toPrivateProfile — internal-only; joins status/isVerified/phoneVerifiedAt from User. Never wired to a public or employer route.

    Verification evidence

  • Schema: prisma/schema.prismaLearnerProfile model.

  • Migration: prisma/migrations/20260730120000_add_learner_profiles/migration.sql.

  • Leakage tests: tests/profile-serializer.test.ts — redaction below each visibility tier, and explicit assertions that employer/public views never carry the private account fields.

  • Service tests: tests/profile.service.test.ts — upsert defaults, partial updates, null-safe view fetching.

  • Controller tests: tests/profile.controller.test.ts — auth gating, validation (closed schema, enum checks), owner/employer/public routing by caller identity.

  • Privacy doc: docs/decisions/0002-learner-profile-visibility.md.

37 new tests added, full suite passing (475 passed, 3 pre-existing DB-integration tests skipped as before — unrelated to this change).

@3m1n3nc3
3m1n3nc3 merged commit a819f33 into learnault:main Jul 30, 2026
1 check passed
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.

Feature: Add Learner Public and Private Profile Schema

3 participants