Skip to content

refactor(admin): migrate data layer to V2 API response contract#1045

Merged
Innei merged 2 commits into
masterfrom
refactor/v2-api-response
May 22, 2026
Merged

refactor(admin): migrate data layer to V2 API response contract#1045
Innei merged 2 commits into
masterfrom
refactor/v2-api-response

Conversation

@Innei
Copy link
Copy Markdown
Member

@Innei Innei commented May 15, 2026

Summary

Migrates the admin dashboard data layer to the mx-core V2 API response contract (success envelope { data, meta? }, error envelope { error: { code, message, details? } }).

Companion to the mx-core V2 API refactor (PR #2729) and the @mx-space/api-client V2 migration.

Changes

  • utils/request.tstransformResponse unwraps the { data, meta? } envelope; lifts meta.pagination to { data, pagination }. onResponseError reads error.message / error.code from the V2 error envelope. BusinessError gains an optional code.
  • models/base.tsPager shape updated to { page, size, total, totalPages }.
  • models/enrichment.ts, models/search-index.ts — local legacy pager types kept; the enrichment-admin and search-admin endpoints still emit the legacy pagination shape.
  • api/posts.ts, api/notes.ts, api/pages.ts — removed the select query param (V2 uses named views instead).
  • View / hook ripple — Pager field renames and select call-site removal across manage-notes, manage-posts, manage-pages, manage-says, manage-project, reader, AI selectors, and comments.

Verification

  • tsc typecheck clean (except a pre-existing unrelated baseUrl warning).
  • oxlint 0 errors.

@safedep
Copy link
Copy Markdown

safedep Bot commented May 15, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

- posts/notes/drafts: switch list sort params to wire-format
  sort_by/sort_order (snake_case enums) to match server's
  createPagerSchema; previous camelCase + numeric -1/1 was rejected
- manage-posts/notes list views: pass the new sort keys through
- webhook create: always send `secret: ''` when the form leaves it
  blank; server's WebhookSchema requires `z.string()` and the admin
  form intentionally treats the field as optional
- docs/superpowers: capture in-progress React migration specs (status,
  layout shell, data flow, datatable, list filter bar, recovery banner,
  rightpane quick edit) so they survive across machines
@Innei Innei force-pushed the refactor/v2-api-response branch from ef2dafd to 40c0434 Compare May 21, 2026 16:41
…slation

Admin always edits/manages original records; no admin endpoint consumes translated payloads. Send `x-skip-translation: 1` on every outbound request (shared $api instance plus the raw agent-chat SSE fetch) so the backend ignores browser-implicit Accept-Language and NEXT_LOCALE cookie. Explicit `?lang=xx` query and `x-lang` header remain respected for business filters (enrichment per-locale rows, search index).
@Innei Innei added this pull request to the merge queue May 22, 2026
Merged via the queue into master with commit 1413356 May 22, 2026
7 checks passed
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