refactor: migrate POST posts update endpoint from PHP to TypeScript#4
refactor: migrate POST posts update endpoint from PHP to TypeScript#4xavierandueza wants to merge 1 commit into
Conversation
…to TypeScript Replace the PHP update post endpoint (WP_REST_Posts_Controller::update_item) with a TypeScript Next.js API route. This is part of the gradual migration of the WordPress REST API from PHP to TypeScript. PHP changes: - Remove EDITABLE route registration from register_routes() - Remove update_item_permissions_check() method - Remove update_item() method - Shared methods (prepare_item_for_database, handle_terms, etc.) preserved TypeScript implementation: - Next.js App Router API route at /api/sites/[site]/posts/[postId] - MySQL2 connection pool with transaction support - WordPress Application Password authentication - Full capability resolution (edit_post meta cap mapping) - Zod request validation matching WP REST API schema - Complete update flow: permissions, validation, DB update, post-update operations (format, media, sticky, template, terms, meta) - Response serialization matching WP REST API format
|
📚 Documentation update workflow has been queued for reopened PR (Job ID: |
📊 PR Analysis SummaryFiles Changed: 24 file(s) Changed Files
Relevant Documentation PagesDocs impacted by this PR
ℹ️ Documentation UpdatesNo automatic documentation updates were applied. This analysis was automatically generated by the ReadMe AI Documentation Bot. |
|
📚 Documentation update workflow has been queued for reopened PR (Job ID: |
📊 PR Analysis SummaryFiles Changed: 24 file(s) Changed Files
Relevant Documentation PagesDocs impacted by this PR
✅ Documentation Changes Applied
This analysis was automatically generated by the ReadMe AI Documentation Bot. |
|
📚 Documentation update workflow has been queued for reopened PR (Job ID: |
|
📚 Documentation update workflow has been queued for reopened PR (Job ID: |
📊 PR Analysis SummaryFiles Changed: 24 file(s) Changed Files
Relevant Documentation PagesDocs impacted by this PR
✅ Documentation Changes Applied
This analysis was automatically generated by the ReadMe AI Documentation Bot. |
📚 Documentation Changes Applied
|
📚 Documentation Changes Applied
|
|
📚 No documentation updates were needed for this PR. |
|
Documentation Changes Added
Actions
|
|
📚 No documentation updates were needed for this PR. |
|
Documentation Changes Added
Actions
|
|
Documentation Changes Added
Actions
|
|
Documentation Changes Added
Actions
|
|
Documentation Changes Added
Actions
|
|
You can re-trigger by reopening this PR. |
|
Documentation Changes Added
Actions
If neither actions are selected, on PR close/merge the docs branch in ReadMe will remain open. |
|
Documentation Changes Added
Actions
If neither actions are selected, on PR close/merge the docs branch in ReadMe will remain open. |
|
Documentation Changes Added
Actions
If neither actions are selected, on PR close/merge the docs branch in ReadMe will remain open. |
|
Documentation Changes Added
Actions
If neither actions are selected, on PR close/merge the docs branch in ReadMe will remain open. |
Summary
POST /wp/v2/posts/{id}(update post) endpoint from the PHPWP_REST_Posts_Controllerto a TypeScript Next.js App Router API routeupdate_item(),update_item_permissions_check()methods, and the EDITABLE route registration, while preserving all shared methods used by other CRUD operationspackage.json,tsconfig.json, MySQL2 connection pool) as part of the gradual PHP-to-TypeScript migrationDetails
The TypeScript implementation faithfully replicates the PHP logic:
edit_postmeta capability mapping matchingmap_meta_cap()behaviorwp_posts,wp_postmeta,wp_term_relationships, andwp_optionstables within a single transactionTest plan
npx tsc --noEmit