Skip to content

feat: extend authuser 4#8690

Open
mikeallisonJS wants to merge 11 commits intomainfrom
00-00-MA-feat-extend-authuser-4
Open

feat: extend authuser 4#8690
mikeallisonJS wants to merge 11 commits intomainfrom
00-00-MA-feat-extend-authuser-4

Conversation

@mikeallisonJS
Copy link
Collaborator

@mikeallisonJS mikeallisonJS commented Feb 4, 2026

Summary by CodeRabbit

  • New Features
    • Added LanguageRole and MediaRole enums (includes publisher role)
    • Exposed languageUserRoles and mediaUserRoles on authenticated user to surface role info across services
  • Refactor
    • Unified AuthenticatedUser as a shared, federated type across APIs for consistent cross-service user data

mikeallisonJS and others added 10 commits February 3, 2026 22:26
- Introduced the AuthenticatedUser type in both API schemas, enhancing user data representation.
- Implemented a resolver for AuthenticatedUser to handle user retrieval and fallback for missing first names.
- Updated user object exports to include AuthenticatedUser for better federation support.
- Added the AuthenticatedUser type to the API schemas, including fields for user details.
- Extended the AuthenticatedUser type to support federation with external services.
- Updated generated TypeScript definitions to reflect the new structure of AuthenticatedUser.
- Modified user-related GraphQL operations to incorporate the new AuthenticatedUser type.
- Updated the AuthenticatedUser type in the API schemas to include federation capabilities with the API_JOURNEYS_MODERN graph.
- Introduced a new external reference for AuthenticatedUser in the user schema to facilitate integration.
- Modified TypeScript exports to include the new AuthenticatedUser reference for improved type handling.
- Deleted the AuthenticatedUser type definition from the GraphQL schema to streamline user data representation.
- This change simplifies the API by removing unnecessary complexity related to user authentication details.
- Added languageUserRoles field to the AuthenticatedUser type in both schema.graphql and schema.graphql for API_LANGUAGES.
- Implemented resolver for languageUserRoles in the user schema to fetch user-specific language roles from the database.
- This update improves the user model by integrating language role management into the authentication process.
- Added mediaUserRoles field to the AuthenticatedUser type in both schema.graphql files for API_MEDIA.
- Implemented resolver for mediaUserRoles in the user schema to fetch user-specific media roles from the database.
- Updated TypeScript exports to include the new AuthenticatedUser reference for better type management.
@mikeallisonJS mikeallisonJS requested a review from csiyang February 4, 2026 20:48
@mikeallisonJS mikeallisonJS self-assigned this Feb 4, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

Adds a federated AuthenticatedUser entity across the gateway and multiple subgraphs (API_JOURNEYS, API_JOURNEYS_MODERN, API_LANGUAGES, API_MEDIA, API_USERS), adds role enums, and surfaces role fields and external refs with resolvers in language/media services.

Changes

Cohort / File(s) Summary
Gateway schema
apis/api-gateway/schema.graphql
Introduced a federated AuthenticatedUser type spanning 5 graphs with fields: id, languageUserRoles, mediaUserRoles, firstName, lastName, email, imageUrl, superAdmin, emailVerified. Added enums LanguageRole and MediaRole. Removed prior single-graph declaration.
Journeys schemas & modules
apis/api-journeys-modern/schema.graphql, apis/api-journeys/schema.graphql, apis/api-journeys/src/app/modules/userTeam/userTeam.graphql
Added/extended AuthenticatedUser as a federated @key/@extends entity and added it to _Entity where applicable.
Languages schema & implementation
apis/api-languages/schema.graphql, apis/api-languages/src/schema/user/user.ts
Added AuthenticatedUser external type and implemented languageUserRoles resolver via prisma; declared LanguageRole enum usage.
Media schema & implementation
apis/api-media/schema.graphql, apis/api-media/src/schema/user/*
Added AuthenticatedUser external type and implemented mediaUserRoles resolver via prisma; declared MediaRole enum usage. Re-exported AuthenticatedUserRef alongside UserRef.
Journeys-modern exports & refs
apis/api-journeys-modern/src/schema/user/index.ts, apis/api-journeys-modern/src/schema/user/user.ts
Added and exported AuthenticatedUserRef external reference (id external) alongside existing UserRef.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(0,128,255,0.5)
    participant Client
    end
    rect rgba(0,200,120,0.5)
    participant Gateway
    end
    rect rgba(200,100,0,0.5)
    participant API_USERS
    participant API_LANGUAGES
    participant API_MEDIA
    end

    Client->>Gateway: request AuthenticatedUser { id, roles, profile }
    Gateway->>API_USERS: _entities(query: [{ __typename: "AuthenticatedUser", id }]) -> basic user fields
    API_USERS-->>Gateway: returns id, profile fields (firstName, email, ...)
    Gateway->>API_LANGUAGES: fetch languageUserRoles for id
    API_LANGUAGES-->>Gateway: returns languageUserRoles[]
    Gateway->>API_MEDIA: fetch mediaUserRoles for id
    API_MEDIA-->>Gateway: returns mediaUserRoles[]
    Gateway-->>Client: merged AuthenticatedUser { id, profile, languageUserRoles, mediaUserRoles }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • csiyang
  • tanflem
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and generic, using non-descriptive phrasing like 'extend authuser 4' that doesn't clearly convey the specific change. Replace with a more descriptive title that clearly summarizes the main change, such as 'feat: add AuthenticatedUser federation across multiple graphs' or 'feat: expose AuthenticatedUser type with role fields to multiple APIs'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 00-00-MA-feat-extend-authuser-4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Feb 4, 2026

View your CI Pipeline Execution ↗ for commit ab487e0

Command Status Duration Result
nx run resources-e2e:e2e ✅ Succeeded 12s View ↗
nx run journeys-e2e:e2e ✅ Succeeded 29s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 29s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 4s View ↗
nx run watch-e2e:e2e ✅ Succeeded 23s View ↗
nx run short-links-e2e:e2e ✅ Succeeded 6s View ↗
nx run player-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
Additional runs (20) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-02-04 21:04:36 UTC

@nx-cloud
Copy link

nx-cloud bot commented Feb 4, 2026

View your CI Pipeline Execution ↗ for commit ab487e0

Command Status Duration Result
nx run short-links-e2e:e2e ✅ Succeeded 6s View ↗
nx run player-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 13s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 2m 59s View ↗
nx run-many --target=vercel-alias --projects=watch ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 9s View ↗
nx run-many --target=vercel-alias --projects=re... ✅ Succeeded 2s View ↗
Additional runs (15) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-02-04 21:03:58 UTC

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin February 4, 2026 20:55 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys February 4, 2026 20:55 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources February 4, 2026 20:55 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin February 4, 2026 20:55 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links February 4, 2026 20:55 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Thu Feb 5 09:58:05 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
short-links ✅ Ready short-links preview Thu Feb 5 09:58:16 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
player ✅ Ready player preview Thu Feb 5 09:58:26 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Thu Feb 5 09:59:19 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Thu Feb 5 09:59:27 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Thu Feb 5 09:59:40 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Thu Feb 5 10:00:32 NZDT 2026

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