Skip to content

fix: data not returning from api-journeys to journeys modern#8944

Open
tanflem wants to merge 3 commits intomainfrom
tannerfleming/nes-1494-template-settings-customisable-text-resets-after-editing-the
Open

fix: data not returning from api-journeys to journeys modern#8944
tanflem wants to merge 3 commits intomainfrom
tannerfleming/nes-1494-template-settings-customisable-text-resets-after-editing-the

Conversation

@tanflem
Copy link
Copy Markdown
Contributor

@tanflem tanflem commented Apr 1, 2026

Summary by CodeRabbit

  • New Features
    • Added a customization description field for journeys to display extra descriptive information about journey customizations in relevant views.
    • When no description is present, the field will return empty/hidden gracefully so UI shows nothing instead of an error.

@tanflem tanflem requested a review from Kneesal April 1, 2026 15:43
@tanflem tanflem self-assigned this Apr 1, 2026
@linear
Copy link
Copy Markdown

linear bot commented Apr 1, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 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: e56fb3a4-16eb-4d7c-9150-6fb09083ed17

📥 Commits

Reviewing files that changed from the base of the PR and between 088adc0 and ee4ddae.

📒 Files selected for processing (1)
  • apis/api-journeys/src/app/modules/journey/journey.resolver.ts

Walkthrough

Adds a GraphQL field resolver journeyCustomizationDescription on the Journey type that queries Prisma journey.findUnique by journey ID and returns the journeyCustomizationDescription string or null if missing.

Changes

Cohort / File(s) Summary
Journey Resolver Enhancement
apis/api-journeys/src/app/modules/journey/journey.resolver.ts
Added @ResolveField('journeyCustomizationDescription') method that performs prisma.journey.findUnique({ where: { id: journey.id }, select: { journeyCustomizationDescription: true } }) and returns the field value or null.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title references a data return issue from api-journeys but the change only adds a single GraphQL field resolver for journeyCustomizationDescription, not a comprehensive fix for data not returning. Consider clarifying the title to be more specific about what data and field is being resolved, such as 'Add journeyCustomizationDescription field resolver' or specify the exact data/feature being fixed.
✅ 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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tannerfleming/nes-1494-template-settings-customisable-text-resets-after-editing-the

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 1, 2026

View your CI Pipeline Execution ↗ for commit ee4ddae

Command Status Duration Result
nx affected --target=subgraph-check --base=326d... ✅ Succeeded 2s View ↗
nx affected --target=extract-translations --bas... ✅ Succeeded <1s View ↗
nx affected --target=lint --base=326d15524f8019... ✅ Succeeded <1s View ↗
nx affected --target=type-check --base=326d1552... ✅ Succeeded <1s View ↗
nx run-many --target=codegen --all --parallel=3 ✅ Succeeded 1s View ↗
nx run-many --target=prisma-generate --all --pa... ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-01 15:55:26 UTC

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 1276-1287: The resolver journeyCustomizationDescription currently
always re-fetches the Journey without filtering out soft-deleted rows and causes
unnecessary DB calls; update JourneyResolver.journeyCustomizationDescription to
first check if the parent Journey object already has
journeyCustomizationDescription (e.g., if
journey.journeyCustomizationDescription !== undefined) and return it
immediately, and only call this.prismaService.journey.findUnique when missing,
adding a soft-delete filter in the query (where: { id: journey.id, deletedAt:
null }) and selecting journeyCustomizationDescription; this avoids N+1 queries
and excludes soft-deleted journeys.
🪄 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: 7ac8d504-cf80-46d1-af58-e309fcc731db

📥 Commits

Reviewing files that changed from the base of the PR and between 326d155 and 088adc0.

📒 Files selected for processing (1)
  • apis/api-journeys/src/app/modules/journey/journey.resolver.ts

Comment on lines +1276 to +1287
@ResolveField('journeyCustomizationDescription')
async journeyCustomizationDescription(
@Parent() journey: Journey
): Promise<string | null> {
const journeyWithCustomizationDescription =
await this.prismaService.journey.findUnique({
where: { id: journey.id },
select: { journeyCustomizationDescription: true }
})

return journeyWithCustomizationDescription?.journeyCustomizationDescription ?? null
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Inspect resolver implementation around journeyCustomizationDescription:"
rg -n -C4 "journeyCustomizationDescription|findUnique|findFirst|deletedAt" apis/api-journeys/src/app/modules/journey/journey.resolver.ts

echo
echo "2) Confirm Journey model includes deletedAt (schema source of truth):"
fd -i "schema.prisma" apis | xargs -r rg -n -C3 "model Journey|deletedAt"

Repository: JesusFilm/core

Length of output: 9514


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== 1) Check Journey type/interface to see what fields are available on `@Parent`() ===" 
rg -n "interface Journey|type Journey" apis/api-journeys/src --max-count=20

echo
echo "=== 2) Compare nearby resolvers (journeyTheme, chatButton) to journeyCustomizationDescription ==="
sed -n '1260,1287p' apis/api-journeys/src/app/modules/journey/journey.resolver.ts

echo
echo "=== 3) Check if Prisma Journey model includes journeyCustomizationDescription as a direct field ==="
fd -i "schema.prisma" apis | xargs -r grep -n -A30 "model Journey"

Repository: JesusFilm/core

Length of output: 6148


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== 1) Check full Prisma Journey model definition ==="
fd -i "schema.prisma" apis | head -1 | xargs grep -A100 "model Journey" | head -60

echo
echo "=== 2) Check if there are other resolvers that access parent fields directly (like journeyCustomizationDescription) ==="
rg -n "@ResolveField|@Parent" apis/api-journeys/src/app/modules/journey/journey.resolver.ts | head -20

echo
echo "=== 3) Look at queries/mutations to understand what fields are typically selected on Journey ==="
rg -n "select:|include:" apis/api-journeys/src/app/modules/journey/journey.resolver.ts | head -15

Repository: JesusFilm/core

Length of output: 113


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== 1) Find schema.prisma file ==="
find apis -name "schema.prisma" -o -name "*.prisma"

echo
echo "=== 2) Once found, check Journey model ==="
find apis -name "*.prisma" | xargs cat 2>/dev/null | grep -A50 "^model Journey"

echo
echo "=== 3) Check if journeyCustomizationDescription appears in parent Journey selections ==="
rg -n "journeyCustomizationDescription" apis/api-journeys/src/app/modules/journey/ --max-count=20

Repository: JesusFilm/core

Length of output: 136


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== 1) Check Journey GraphQL type definition ==="
rg -n -A30 "^type Journey" apis/api-journeys/src/app/modules/journey/journey.graphql

echo
echo "=== 2) Check if journeyCustomizationDescription is a direct field on Journey ==="
rg -n "journeyCustomizationDescription" apis/api-journeys/src/app/modules/journey/journey.graphql

echo
echo "=== 3) Check the journeyCustomizationField module which extends Journey ==="
rg -n -A10 "extend type Journey" apis/api-journeys/src/app/modules/journeyCustomizationField/journeyCustomizationField.graphql

Repository: JesusFilm/core

Length of output: 995


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== 1) Check what journeyCustomizationField extends Journey with ==="
cat apis/api-journeys/src/app/modules/journeyCustomizationField/journeyCustomizationField.graphql

echo
echo "=== 2) Check other extend type Journey declarations ==="
rg -n -B2 "extend type Journey" apis/api-journeys/src/app/modules/

echo
echo "=== 3) Check how journeyCustomizationDescription resolver is used in queries/how it's typically selected ==="
rg -n "journeyCustomizationDescription" apis/api-journeys/src/ -A2 -B2 | head -40

Repository: JesusFilm/core

Length of output: 6806


Add soft-delete filter and avoid redundant fetches.

This resolver re-fetches the Journey entity without a deletedAt: null filter, violating the coding guideline. Additionally, it unconditionally hits the database even if the field may already be available on the parent Journey object, creating N+1 behavior on list queries.

Proposed change
   `@ResolveField`('journeyCustomizationDescription')
   async journeyCustomizationDescription(
     `@Parent`() journey: Journey
   ): Promise<string | null> {
+    if (journey.journeyCustomizationDescription != null) {
+      return journey.journeyCustomizationDescription
+    }
+
     const journeyWithCustomizationDescription =
-      await this.prismaService.journey.findUnique({
-        where: { id: journey.id },
+      await this.prismaService.journey.findFirst({
+        where: { id: journey.id, deletedAt: null },
         select: { journeyCustomizationDescription: true }
       })
 
-    return journeyWithCustomizationDescription?.journeyCustomizationDescription ?? null
+    return (
+      journeyWithCustomizationDescription?.journeyCustomizationDescription ?? null
+    )
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apis/api-journeys/src/app/modules/journey/journey.resolver.ts` around lines
1276 - 1287, The resolver journeyCustomizationDescription currently always
re-fetches the Journey without filtering out soft-deleted rows and causes
unnecessary DB calls; update JourneyResolver.journeyCustomizationDescription to
first check if the parent Journey object already has
journeyCustomizationDescription (e.g., if
journey.journeyCustomizationDescription !== undefined) and return it
immediately, and only call this.prismaService.journey.findUnique when missing,
adding a soft-delete filter in the query (where: { id: journey.id, deletedAt:
null }) and selecting journeyCustomizationDescription; this avoids N+1 queries
and excludes soft-deleted journeys.

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