Skip to content

feat: add notes field to VideoBlock#8809

Open
jaco-brink wants to merge 6 commits intomainfrom
jacobusbrink/nes-1316-backend-add-new-field-to-capture-notes
Open

feat: add notes field to VideoBlock#8809
jaco-brink wants to merge 6 commits intomainfrom
jacobusbrink/nes-1316-backend-add-new-field-to-capture-notes

Conversation

@jaco-brink
Copy link
Contributor

@jaco-brink jaco-brink commented Mar 5, 2026

Summary

Adds a nullable notes String field to VideoBlock for the template customization flow so publishers can describe the purpose of each video (e.g. "trailer", "intro") for template adapters.

Changes

  • Prisma: notes String? on Block model + migration (20260305200417_add_video_block_notes)
  • api-journeys: notes: String @shareable on VideoBlock in federation schema
  • api-journeys-modern: notes on VideoBlockUpdateInput and VideoBlock Pothos type; unit tests for read/update/clear

QA

  1. Query a VideoBlock → notes exists, returns null by default
  2. videoBlockUpdate with notes: "test trailer note" → re-query confirms value
  3. videoBlockUpdate with notes: "" → value clears

Closes NES-1316

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Video blocks now support a publisher notes field for template adapters (e.g., "trailer", "intro"); notes can be added, updated, and cleared.
  • Tests

    • Added tests covering setting and clearing video block notes to ensure persistence and correct update behavior.
  • Chores

    • Database schema and API surface updated to persist and expose the new video block notes field.

- Add nullable notes String to Prisma Block model and migration
- Add notes to VideoBlock in api-journeys federation schema
- Add notes to VideoBlockUpdateInput and VideoBlock type in api-journeys-modern
- Add unit tests for notes read, update, and clear
- Regenerate GraphQL schemas and api-journeys client

Made-with: Cursor
@linear
Copy link

linear bot commented Mar 5, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

Warning

Rate limit exceeded

@autofix-ci[bot] has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 53 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cf27acf7-0e53-4b98-8912-646dc8e720da

📥 Commits

Reviewing files that changed from the base of the PR and between e1a2ba5 and 8f0bda9.

⛔ Files ignored due to path filters (1)
  • apis/api-journeys/src/app/__generated__/graphql.ts is excluded by !**/__generated__/**
📒 Files selected for processing (4)
  • apis/api-gateway/schema.graphql
  • apis/api-journeys-modern/schema.graphql
  • apis/api-journeys-modern/src/schema/block/video/inputs/videoBlockCreateInput.ts
  • apis/api-journeys-modern/src/schema/block/video/videoBlockUpdate.mutation.spec.ts

Walkthrough

Adds an optional notes field to VideoBlock across GraphQL schemas, TypeScript schema, Prisma model/migration, and tests; exposes notes on the API and VideoBlockUpdateInput to allow setting and clearing publisher notes.

Changes

Cohort / File(s) Summary
GraphQL schemas
apis/api-gateway/schema.graphql, apis/api-journeys-modern/schema.graphql, apis/api-journeys/src/app/modules/block/video/video.graphql
Added notes: String to VideoBlock types (with docstring where present) and added notes: String to VideoBlockUpdateInput where applicable.
TypeScript schema implementation
apis/api-journeys-modern/src/schema/block/video/video.ts, apis/api-journeys-modern/src/schema/block/video/inputs/videoBlockUpdateInput.ts
Exposed nullable notes field on VideoBlock schema and added optional notes to VideoBlockUpdateInput definition.
Database (Prisma)
libs/prisma/journeys/db/schema.prisma, libs/prisma/journeys/db/migrations/20260305200417_add_video_block_notes/migration.sql
Added optional notes (String?) to Block model and migration SQL to add a nullable notes column.
Tests
apis/api-journeys-modern/src/schema/block/video/videoBlockUpdate.mutation.spec.ts
Added tests covering updating and clearing notes via the videoBlockUpdate mutation; asserts persistence and that block.update receives the notes payload.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant APIGateway as API_Gateway
    participant JourneysAPI as Journeys_Service
    participant DB as Database

    Client->>APIGateway: videoBlockUpdate(input: { id, notes })
    APIGateway->>JourneysAPI: Forward mutation (includes notes)
    JourneysAPI->>DB: UPDATE Block SET notes = <value> WHERE id = <id>
    DB-->>JourneysAPI: OK / updated row
    JourneysAPI-->>APIGateway: Return updated block { id, notes, ... }
    APIGateway-->>Client: Return updated block with notes
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: add notes field to VideoBlock' accurately and concisely describes the main change: adding a new notes field to the VideoBlock type across the schema and codebase.
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 unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jacobusbrink/nes-1316-backend-add-new-field-to-capture-notes

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.

@jaco-brink jaco-brink self-assigned this Mar 5, 2026
@jaco-brink jaco-brink requested a review from jianwei1 March 5, 2026 20:10
@nx-cloud
Copy link

nx-cloud bot commented Mar 5, 2026

View your CI Pipeline Execution ↗ for commit 8f0bda9

Command Status Duration Result
nx run player-e2e:e2e ✅ Succeeded 5s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 7s View ↗
nx run journeys-e2e:e2e ✅ Succeeded 29s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 33s View ↗
nx run watch-e2e:e2e ✅ Succeeded 36s View ↗
nx run resources-e2e:e2e ✅ Succeeded 12s View ↗
nx run short-links-e2e:e2e ✅ Succeeded 3s 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-03-05 21:17:41 UTC

@github-actions github-actions bot temporarily deployed to Preview - journeys March 5, 2026 20:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 5, 2026 20:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 5, 2026 20:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch March 5, 2026 20:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 5, 2026 20:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 5, 2026 20:11 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 5, 2026 20:11 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Fri Mar 6 10:08:07 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
short-links ✅ Ready short-links preview Fri Mar 6 10:08:27 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Fri Mar 6 10:08:42 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Fri Mar 6 10:09:41 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Fri Mar 6 10:09:01 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Fri Mar 6 10:08:06 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
player ✅ Ready player preview Fri Mar 6 10:08:07 NZDT 2026

@github-actions github-actions bot temporarily deployed to Preview - watch March 5, 2026 20:17 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 5, 2026 20:17 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 5, 2026 20:17 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 5, 2026 20:17 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 5, 2026 20:17 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 5, 2026 20:17 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 5, 2026 20:17 Inactive
Copy link
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

🧹 Nitpick comments (1)
apis/api-journeys-modern/schema.graphql (1)

2471-2471: Consider create/update symmetry for notes.

If clients need to set notes on initial block creation, adding notes to VideoBlockCreateInput would avoid a follow-up update mutation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apis/api-journeys-modern/schema.graphql` at line 2471, The schema currently
exposes notes on the VideoBlock type but not in the creation input; add the
notes field to VideoBlockCreateInput so clients can set notes on initial
creation (mirroring VideoBlockUpdateInput/notes) and ensure the server
resolver/validation that handles VideoBlockCreateInput accepts and persists
notes in the same way as updates.
🤖 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/video/videoBlockUpdate.mutation.spec.ts`:
- Around line 200-235: Decide whether clearing notes should persist as an empty
string or as null, then update the test and mocks to match that contract: if the
semantic is "unset", change the mocked transaction return
(tx.block.update.mockResolvedValue) to have notes: null and update the assertion
expect(...videoBlockUpdate.notes).toBeNull() and the
expect(tx.block.update).toHaveBeenCalledWith(...) data expectation to
expect.objectContaining({ notes: null }); if the semantic is to store an empty
string, ensure the resolver/service normalizes input to '' (or leave as-is) and
keep the mocked return and assertions as notes: '' and expect(...).toBe('') so
the test, the tx.mockResolvedValue, and the called-with data are consistent with
the chosen behavior.

---

Nitpick comments:
In `@apis/api-journeys-modern/schema.graphql`:
- Line 2471: The schema currently exposes notes on the VideoBlock type but not
in the creation input; add the notes field to VideoBlockCreateInput so clients
can set notes on initial creation (mirroring VideoBlockUpdateInput/notes) and
ensure the server resolver/validation that handles VideoBlockCreateInput accepts
and persists notes in the same way as updates.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c045d544-6765-4805-873d-42d0bdd0b8e1

📥 Commits

Reviewing files that changed from the base of the PR and between b84f5b3 and f578bd1.

⛔ Files ignored due to path filters (1)
  • apis/api-journeys/src/app/__generated__/graphql.ts is excluded by !**/__generated__/**
📒 Files selected for processing (8)
  • apis/api-gateway/schema.graphql
  • apis/api-journeys-modern/schema.graphql
  • apis/api-journeys-modern/src/schema/block/video/inputs/videoBlockUpdateInput.ts
  • apis/api-journeys-modern/src/schema/block/video/video.ts
  • apis/api-journeys-modern/src/schema/block/video/videoBlockUpdate.mutation.spec.ts
  • apis/api-journeys/src/app/modules/block/video/video.graphql
  • libs/prisma/journeys/db/migrations/20260305200417_add_video_block_notes/migration.sql
  • libs/prisma/journeys/db/schema.prisma

Copy link
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.

🧹 Nitpick comments (1)
apis/api-journeys-modern/src/schema/block/video/videoBlockUpdate.mutation.spec.ts (1)

192-194: Extract a shared response type instead of repeating inline assertions.

The same inline cast appears twice; a local type alias will reduce duplication and improve readability.

♻️ Suggested refactor
+ type VideoBlockUpdateResult = {
+   data?: { videoBlockUpdate: { notes: string | null } }
+ }
+
   it('updates and returns notes when notes is set', async () => {
@@
-    expect(
-      (result as { data?: { videoBlockUpdate: { notes: string } } }).data
-        ?.videoBlockUpdate.notes
-    ).toBe('test trailer note')
+    expect((result as VideoBlockUpdateResult).data?.videoBlockUpdate.notes).toBe(
+      'test trailer note'
+    )
@@
   it('clears notes when notes is set to empty string', async () => {
@@
-    expect(
-      (result as { data?: { videoBlockUpdate: { notes: string } } }).data
-        ?.videoBlockUpdate.notes
-    ).toBe('')
+    expect((result as VideoBlockUpdateResult).data?.videoBlockUpdate.notes).toBe(
+      ''
+    )

As per coding guidelines, "Define a type if possible."

Also applies to: 232-234

🤖 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/video/videoBlockUpdate.mutation.spec.ts`
around lines 192 - 194, Extract a shared type alias for the mutation response
and reuse it instead of repeating the inline cast; e.g. declare a type like
VideoBlockUpdateResponse = { data?: { videoBlockUpdate: { notes: string } } }
near the top of the spec and replace both occurrences of (result as { data?: {
videoBlockUpdate: { notes: string } } }) with (result as
VideoBlockUpdateResponse) so assertions that access
.data?.videoBlockUpdate.notes for the videoBlockUpdate mutation use the shared
alias.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apis/api-journeys-modern/src/schema/block/video/videoBlockUpdate.mutation.spec.ts`:
- Around line 192-194: Extract a shared type alias for the mutation response and
reuse it instead of repeating the inline cast; e.g. declare a type like
VideoBlockUpdateResponse = { data?: { videoBlockUpdate: { notes: string } } }
near the top of the spec and replace both occurrences of (result as { data?: {
videoBlockUpdate: { notes: string } } }) with (result as
VideoBlockUpdateResponse) so assertions that access
.data?.videoBlockUpdate.notes for the videoBlockUpdate mutation use the shared
alias.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9aace2dc-38a1-4670-a12d-92135fbc127a

📥 Commits

Reviewing files that changed from the base of the PR and between f578bd1 and fce3817.

⛔ Files ignored due to path filters (2)
  • apps/journeys-admin/__generated__/globalTypes.ts is excluded by !**/__generated__/**
  • libs/shared/gql/src/__generated__/graphql-env.d.ts is excluded by !**/__generated__/**
📒 Files selected for processing (1)
  • apis/api-journeys-modern/src/schema/block/video/videoBlockUpdate.mutation.spec.ts

@github-actions github-actions bot temporarily deployed to Preview - watch March 5, 2026 20:48 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 5, 2026 20:48 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 5, 2026 20:48 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 5, 2026 20:48 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 5, 2026 20:48 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 5, 2026 20:48 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 5, 2026 20:48 Inactive
- Add notes to VideoBlockCreateInput for create/update symmetry
- Extract VideoBlockUpdateResult type in spec to reduce duplication

Made-with: Cursor
@jaco-brink
Copy link
Contributor Author

Review feedback addressed (87d0ab1)

Fixed:

  • Add notes to VideoBlockCreateInput: Added notes: t.string({ required: false }) for create/update symmetry so clients can set notes on initial block creation.
  • Extract shared response type: Introduced VideoBlockUpdateResult type alias in the spec to reduce duplication per coding guidelines.

Not changed:

  • Clearing notes behavior: Kept empty string ("") as the "cleared" value per QA step 5 in the issue ("Run videoBlockUpdate with notes: "" and confirm the value clears"). The resolver passes input directly to Prisma; no normalization added.

@github-actions github-actions bot temporarily deployed to Preview - player March 5, 2026 21:00 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 5, 2026 21:00 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 5, 2026 21:00 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 5, 2026 21:00 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch March 5, 2026 21:00 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 5, 2026 21:00 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 5, 2026 21:00 Inactive
@stage-branch-merger
Copy link

I see you added the "on stage" label, I'll get this merged to the stage branch!

1 similar comment
@stage-branch-merger
Copy link

I see you added the "on stage" label, I'll get this merged to the stage branch!

@github-actions github-actions bot temporarily deployed to Preview - resources March 5, 2026 21:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 5, 2026 21:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 5, 2026 21:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links March 5, 2026 21:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch March 5, 2026 21:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 5, 2026 21:05 Inactive
@github-actions github-actions bot temporarily deployed to Preview - player March 5, 2026 21:06 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant