Skip to content

feat(api-journeys): add journeyTemplateLanguageIds query#8976

Merged
jianwei1 merged 6 commits intomainfrom
26-03-JC-feat-template-language-ids-query
Apr 8, 2026
Merged

feat(api-journeys): add journeyTemplateLanguageIds query#8976
jianwei1 merged 6 commits intomainfrom
26-03-JC-feat-template-language-ids-query

Conversation

@jianwei1
Copy link
Copy Markdown
Contributor

@jianwei1 jianwei1 commented Apr 8, 2026

Resolves NES-1542

Summary

  • Adds journeyTemplateLanguageIds: [String!]! GraphQL query to api-journeys
  • Returns distinct language IDs from published templates (template=true, status=published, teamId='jfp-team')
  • Uses Prisma findMany with distinct: ['languageId'] and select: { languageId: true } for efficient querying
  • No authentication required (public templates page)

This is the backend half of NES-1537. The frontend PR (#8973) depends on this query being available.

Test plan

  • 3 unit tests: happy path (distinct IDs returned), deduplication (one entry per language), empty array (no published templates)
  • Verify query works in GraphQL playground after deploy

Post-Deploy Monitoring & Validation

  • Log queries: Monitor api-journeys logs for errors on journeyTemplateLanguageIds query
  • Expected healthy signal: Query returns array of language ID strings matching published template languages
  • Failure signal: Query errors or returns unexpected empty results
  • Validation window: Verify within 1 hour of deploy

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a query to retrieve distinct language IDs from published journey templates for populating template language filters.
  • Tests

    • Added tests verifying multiple, single, and empty results for the language-ID retrieval query.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8fadc9bd-9ad8-4cc5-a2b5-61e1ea7ffb1b

📥 Commits

Reviewing files that changed from the base of the PR and between 6be2742 and 714199d.

⛔ Files ignored due to path filters (1)
  • apis/api-journeys/src/__generated__/graphql.ts is excluded by !**/__generated__/**
📒 Files selected for processing (4)
  • apis/api-gateway/schema.graphql
  • apis/api-journeys/schema.graphql
  • apis/api-journeys/src/app/modules/journey/journey.graphql
  • apis/api-journeys/src/app/modules/journey/journey.resolver.ts
✅ Files skipped from review due to trivial changes (1)
  • apis/api-gateway/schema.graphql
🚧 Files skipped from review as they are similar to previous changes (2)
  • apis/api-journeys/src/app/modules/journey/journey.graphql
  • apis/api-journeys/src/app/modules/journey/journey.resolver.ts

Walkthrough

Adds a new GraphQL query journeyTemplateLanguageIds returning a non-null list of distinct language ID strings from published journey templates; includes schema additions in gateway and journeys APIs, a resolver implementation, and unit tests.

Changes

Cohort / File(s) Summary
Journeys API - GraphQL & Resolver
apis/api-journeys/src/app/modules/journey/journey.graphql, apis/api-journeys/schema.graphql, apis/api-journeys/src/app/modules/journey/journey.resolver.ts, apis/api-journeys/src/app/modules/journey/journey.resolver.spec.ts
Added journeyTemplateLanguageIds: [String!]! query. Resolver uses prismaService.journey.findMany filtering template: true, status: published, teamId: 'jfp-team' with distinct: ['languageId'] and select: { languageId: true }, then maps results to string[]. Tests cover multiple IDs, single ID, and empty results.
API Gateway Schema
apis/api-gateway/schema.graphql
Exposed journeyTemplateLanguageIds: [String!]! @join__field(graph: API_JOURNEYS) on the gateway Query type.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Gateway as API_Gateway
  participant Journeys as API_JOURNEYS
  participant DB as Prisma/Database

  Client->>Gateway: query journeyTemplateLanguageIds
  Gateway->>Journeys: delegated `@join__field` request
  Journeys->>DB: findMany(where:{template:true,status:published,teamId:"jfp-team"}, distinct:["languageId"], select:{languageId:true})
  DB-->>Journeys: [{languageId:"en"},{languageId:"es"},...]
  Journeys-->>Gateway: ["en","es",...]
  Gateway-->>Client: ["en","es",...]
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(api-journeys): add journeyTemplateLanguageIds query' accurately and concisely describes the primary change: adding a new GraphQL query field to the api-journeys service.
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 26-03-JC-feat-template-language-ids-query

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
Copy Markdown

nx-cloud Bot commented Apr 8, 2026

View your CI Pipeline Execution ↗ for commit 714199d

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

☁️ Nx Cloud last updated this comment at 2026-04-08 04:57:46 UTC

@jianwei1 jianwei1 self-assigned this Apr 8, 2026
Add new GraphQL query that returns distinct language IDs from published
templates (template=true, status=published, teamId=jfp-team). Uses
Prisma findMany with distinct to efficiently fetch only the unique
language IDs without loading full journey data.

This query enables the frontend templates page language dropdown to be
dynamically populated instead of using a hardcoded language list.

NES-1537

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jianwei1 jianwei1 force-pushed the 26-03-JC-feat-template-language-ids-query branch from 31cc57d to 3d3d034 Compare April 8, 2026 03:43
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apis/api-journeys/src/app/modules/journey/journey.resolver.ts`:
- Around line 214-221: The Prisma query in journey.resolver.ts calling
this.prismaService.journey.findMany (the query that selects distinct languageId
for templates) is missing the soft-delete filter; update the where clause in
that query to include deletedAt: null so only non-deleted journeys are returned
(i.e., add deletedAt: null alongside template: true, status:
JourneyStatus.published, teamId: 'jfp-team').
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 380d77d6-442d-42af-93fd-d0d6e4fa0507

📥 Commits

Reviewing files that changed from the base of the PR and between 9f0f429 and 3d3d034.

⛔ Files ignored due to path filters (1)
  • apis/api-journeys/src/app/__generated__/graphql.ts is excluded by !**/__generated__/**
📒 Files selected for processing (3)
  • apis/api-journeys/src/app/modules/journey/journey.graphql
  • apis/api-journeys/src/app/modules/journey/journey.resolver.spec.ts
  • apis/api-journeys/src/app/modules/journey/journey.resolver.ts

Comment thread apis/api-journeys/src/app/modules/journey/journey.resolver.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 8, 2026 03:59 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 8, 2026 03:59 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 8, 2026 03:59 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - resources April 8, 2026 03:59 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 8, 2026 03:59 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - short-links April 8, 2026 03:59 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - player April 8, 2026 03:59 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Wed Apr 8 16:54:00 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
short-links ✅ Ready short-links preview Wed Apr 8 16:53:45 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
player ✅ Ready player preview Wed Apr 8 16:53:51 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Wed Apr 8 16:53:58 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Wed Apr 8 16:54:33 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Wed Apr 8 16:54:11 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Wed Apr 8 16:54:19 NZST 2026

@linear
Copy link
Copy Markdown

linear Bot commented Apr 8, 2026

@github-actions github-actions Bot temporarily deployed to Preview - resources April 8, 2026 04:23 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - player April 8, 2026 04:23 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 8, 2026 04:23 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - short-links April 8, 2026 04:23 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 8, 2026 04:23 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 8, 2026 04:23 Inactive
@jianwei1 jianwei1 removed the request for review from csiyang April 8, 2026 04:35
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot temporarily deployed to Preview - watch April 8, 2026 04:38 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 8, 2026 04:38 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 8, 2026 04:38 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 8, 2026 04:38 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - player April 8, 2026 04:38 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - short-links April 8, 2026 04:38 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - resources April 8, 2026 04:38 Inactive
Comment thread apis/api-journeys/src/app/modules/journey/journey.resolver.ts
@blacksmith-sh

This comment has been minimized.

@Ur-imazing Ur-imazing self-requested a review April 8, 2026 04:50
Ur-imazing
Ur-imazing previously approved these changes Apr 8, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jianwei1 jianwei1 enabled auto-merge April 8, 2026 04:52
@github-actions github-actions Bot temporarily deployed to Preview - short-links April 8, 2026 04:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 8, 2026 04:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - resources April 8, 2026 04:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 8, 2026 04:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 8, 2026 04:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 8, 2026 04:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - player April 8, 2026 04:52 Inactive
@jianwei1 jianwei1 added this pull request to the merge queue Apr 8, 2026
Merged via the queue into main with commit 2d4a0dd Apr 8, 2026
39 checks passed
@jianwei1 jianwei1 deleted the 26-03-JC-feat-template-language-ids-query branch April 8, 2026 04:59
jianwei1 added a commit that referenced this pull request Apr 8, 2026
Resolve conflicts by accepting main's backend files (backend PR #8976
already merged).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tanflem pushed a commit that referenced this pull request Apr 13, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants