Conversation
…api-journeys-override-skill
…odify existing iconBlockCreate mutation for modern API
…tions for iconBlock mutations
…ization patterns in API journeys
…ck mutation in API gateway
WalkthroughThis PR adds a new Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant GraphQL as GraphQL Resolver
participant Auth as Authorization
participant Transform as Input Transform
participant DB as Prisma (Database)
participant Response
Client->>GraphQL: imageBlockUpdate(id, input, journeyId)
GraphQL->>Auth: authorizeBlockUpdate(id, user)
alt Authorized
Auth-->>GraphQL: ✓ Permission granted
GraphQL->>Transform: transformInput(input)
Transform-->>GraphQL: transformed input
GraphQL->>DB: block.update(where: {id}, data: {...})
GraphQL->>DB: journey.update(where: {id}, data: {...})
DB-->>GraphQL: updated ImageBlock
GraphQL-->>Response: ImageBlock data
Response-->>Client: mutation success
else Unauthorized
Auth-->>GraphQL: ✗ Permission denied
GraphQL-->>Response: error: "User not allowed"
Response-->>Client: error response
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run journeys-e2e:e2e |
❌ Failed | 4m 9s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-04-09 21:25:38 UTC
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
Found 1 test failure on Blacksmith runners: Failure
|
…lockupdate-modern
|
I see you added the "on stage" label, I'll get this merged to the stage branch! |
|
Merge conflict attempting to merge this into stage. Please fix manually. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apis/api-journeys-modern/src/schema/block/image/imageBlockUpdate.mutation.spec.ts (1)
89-89: Replacecb: anywith a concrete callback type.A concrete type is available here (
typeof tx), soanyshould be avoided in these transaction mock callbacks.Suggested patch
- prismaMock.$transaction.mockImplementation(async (cb: any) => await cb(tx)) + prismaMock.$transaction.mockImplementation( + async (cb: (txArg: typeof tx) => Promise<unknown>) => await cb(tx) + ) @@ - prismaMock.$transaction.mockImplementation(async (cb: any) => await cb(tx)) + prismaMock.$transaction.mockImplementation( + async (cb: (txArg: typeof tx) => Promise<unknown>) => await cb(tx) + ) @@ - prismaMock.$transaction.mockImplementation(async (cb: any) => await cb(tx)) + prismaMock.$transaction.mockImplementation( + async (cb: (txArg: typeof tx) => Promise<unknown>) => await cb(tx) + )As per coding guidelines,
**/*.{ts,tsx}: “Define a type if possible.”Also applies to: 198-198, 275-275
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apis/api-journeys-modern/src/schema/block/image/imageBlockUpdate.mutation.spec.ts` at line 89, The jest mock for prismaMock.$transaction currently types the callback parameter as any; change the parameter type for the mockImplementation arrow function so the callback is typed using typeof tx (e.g. cb: (client: typeof tx) => Promise<unknown>) instead of any. Update the mock at prismaMock.$transaction.mockImplementation(async (cb: any) => await cb(tx)) to use the concrete callback type referencing tx so TypeScript can validate the callback signature; apply the same replacement for the other occurrences noted (lines around the other prismaMock.$transaction mocks).
🤖 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-modern/src/schema/block/image/imageBlockUpdate.mutation.spec.ts`:
- Around line 55-57: Replace the loose callback typing "cb: any" in the
$transaction mock implementations with the proper Prisma transaction callback
type, e.g. use the signature (cb: (prisma: Prisma.TransactionClient) =>
Promise<any>) or a generic version like <T>(cb: (prisma:
Prisma.TransactionClient) => Promise<T>) to type the parameter; import
Prisma.TransactionClient from `@prisma/client` and update the three $transaction
mockImplementation occurrences (the mocks that accept "cb") in
imageBlockUpdate.mutation.spec.ts so the cb parameter is explicitly typed
accordingly.
In
`@apis/api-journeys-modern/src/schema/block/image/imageBlockUpdate.mutation.ts`:
- Line 2: The image block update mutation (imageBlockUpdate.mutation) currently
calls authorizeBlockUpdate and update but never validates the supplied
parentBlockId; insert a call to validateParentBlock(parentBlockId, ctx) (or the
same validateParentBlock signature used elsewhere) immediately after
authorizeBlockUpdate(...) and before calling update(...) so the parentBlockId is
checked for cross-journey/invalid linkage; apply the same change pattern used in
other block create/update mutations (e.g., lines 22-26 equivalents) to ensure
consistent parent validation.
- Around line 25-26: The issue: calling transformInput unconditionally on
args.input can overwrite existing image metadata (width/height/blurhash) when
src is omitted. Fix by fetching the existing record (using id) and only apply
transformInput when args.input.src is present, otherwise merge args.input into
the existing values so width/height/blurhash are preserved; update should be
called with a merged object (e.g., existing + args.input) or with transformed
values only when transformInput runs. Modify the logic around transformInput,
id, args.input and the call to update to ensure partial updates don't zero out
image metadata.
---
Nitpick comments:
In
`@apis/api-journeys-modern/src/schema/block/image/imageBlockUpdate.mutation.spec.ts`:
- Line 89: The jest mock for prismaMock.$transaction currently types the
callback parameter as any; change the parameter type for the mockImplementation
arrow function so the callback is typed using typeof tx (e.g. cb: (client:
typeof tx) => Promise<unknown>) instead of any. Update the mock at
prismaMock.$transaction.mockImplementation(async (cb: any) => await cb(tx)) to
use the concrete callback type referencing tx so TypeScript can validate the
callback signature; apply the same replacement for the other occurrences noted
(lines around the other prismaMock.$transaction mocks).
🪄 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: 77e35cbe-53ec-487f-924d-4c20e66e62f2
📒 Files selected for processing (5)
apis/api-gateway/schema.graphqlapis/api-journeys-modern/schema.graphqlapis/api-journeys-modern/src/schema/block/image/imageBlockUpdate.mutation.spec.tsapis/api-journeys-modern/src/schema/block/image/imageBlockUpdate.mutation.tsapis/api-journeys-modern/src/schema/block/image/index.ts
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Summary by CodeRabbit
New Features
Tests