Skip to content

Co-locate gift-links response serializers in the service module - #28809

Merged
rob-ghost merged 1 commit into
mainfrom
chore/gift-links-colocate-serializers
Jun 24, 2026
Merged

rob-ghost merged 1 commit into
mainfrom
chore/gift-links-colocate-serializers

Conversation

@rob-ghost

@rob-ghost rob-ghost commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The gift-links response serialization lived in the API serializer layer, away from the rest of the module's concerns — its database mapping, queries, models, and service. The logic for one feature was split across two parts of the codebase.

Solution

Move the whole serialization — the response schemas, the transforms, and the endpoint-to-schema mapping — into the gift-links service module as a pure ES module, so it sits alongside the module's other concerns. The framework's output serializer registry points straight at it, so there is no separate adapter file. The module now owns all of its concerns in one place.

Stacked on #28783 — review this as the serializer move on top of that branch's data-layer split. Retargets to main once that merges.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 981cd62a-4407-4f06-9af6-e1f40d068ffd

📥 Commits

Reviewing files that changed from the base of the PR and between fed7436 and 3495e23.

📒 Files selected for processing (2)
  • ghost/core/core/server/api/endpoints/utils/serializers/output/gift-links.ts
  • ghost/core/core/server/services/gift-links/serializers.ts

Walkthrough

The PR extracts gift-links Zod response schemas and transform pipelines from the API output serializer into a new serializers.ts module co-located in the gift-links service directory. The new module exports toGiftLinksResponse (maps a GiftLink array to the gift_links API shape) and toRevokeAllResponse (wraps a {count} input into {meta: {count}}). The API output serializer at gift-links.ts is then updated to import these shared helpers, introduces a serializeGiftLinks helper, and routes read/issue/reissue through it and revokeAll through toRevokeAllResponse.

Suggested reviewers

  • jonatansberg
✨ 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 chore/gift-links-colocate-serializers

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.

@nx-cloud

nx-cloud Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 2f8214b

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 2m 34s View ↗
nx run ghost:test:ci:integration:no-coverage ✅ Succeeded 2m 38s View ↗
nx build @tryghost/signup-form ✅ Succeeded <1s View ↗
nx build @tryghost/admin-toolbar ✅ Succeeded <1s View ↗
nx build @tryghost/comments-ui ✅ Succeeded <1s View ↗
nx build @tryghost/sodo-search ✅ Succeeded <1s View ↗
nx run ghost:test:ci:legacy ✅ Succeeded 2m 51s View ↗
nx build @tryghost/announcement-bar ✅ Succeeded <1s View ↗
Additional runs (9) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-24 11:21:31 UTC

@rob-ghost
rob-ghost force-pushed the chore/gift-links-colocate-serializers branch from e7fee58 to fed7436 Compare June 22, 2026 23:06
Base automatically changed from chore/gift-links-colocate-db-concerns to main June 24, 2026 10:47
@rob-ghost
rob-ghost force-pushed the chore/gift-links-colocate-serializers branch from fed7436 to 2f8214b Compare June 24, 2026 10:51
no ref

The response-shaping transforms (domain gift links to the API response shapes) live in the gift-links service module. The endpoint-to-serializer mapping stays in the API output serializer module, which the framework wires up and which now calls the domain transforms. The module owns how its data is shaped; the framework boundary owns which endpoint emits what.
@rob-ghost
rob-ghost force-pushed the chore/gift-links-colocate-serializers branch from 2f8214b to 3495e23 Compare June 24, 2026 11:10
@rob-ghost
rob-ghost marked this pull request as ready for review June 24, 2026 11:27
@rob-ghost
rob-ghost merged commit 27fa2b1 into main Jun 24, 2026
48 of 49 checks passed
@rob-ghost
rob-ghost deleted the chore/gift-links-colocate-serializers branch June 24, 2026 11:27
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