- Added new fields to the Blog entity: sources, review_status, reviewer, reviewed_at, review_note, and topic_slug.
- Created API endpoints for reviewing blog posts: GET /api/v1/admin/blog/review-queue and POST /api/v1/admin/blog/{uuid}/review.
- Updated BlogController to handle review logic, including approval and rejection of posts.
- Introduced BlogReviewPage component for admin interface to manage blog reviews.
- Added migration to update the database schema for new fields.
- Implemented tests for review queue functionality and review decision handling.
41 lines
1.9 KiB
PHP
41 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
*/
|
|
final class Version20260723171254 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Add medical-review gate fields to blogs (sources, review_status, reviewer, reviewed_at, review_note, topic_slug)';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
// Scoped to the blogs table only. Unrelated project-wide schema drift that
|
|
// doctrine:diff also emitted (messenger_messages, date_overrides, …) is
|
|
// deliberately left out — it belongs to other migrations, not this feature.
|
|
$this->addSql('ALTER TABLE blogs ADD sources JSON NOT NULL, ADD review_status VARCHAR(20) DEFAULT NULL, ADD reviewed_at INT DEFAULT NULL, ADD review_note VARCHAR(500) DEFAULT NULL, ADD topic_slug VARCHAR(255) DEFAULT NULL, ADD reviewer_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE blogs ADD CONSTRAINT FK_F41BCA7070574616 FOREIGN KEY (reviewer_id) REFERENCES users (id) ON DELETE SET NULL');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_F41BCA70A076FAD7 ON blogs (topic_slug)');
|
|
$this->addSql('CREATE INDEX IDX_F41BCA7070574616 ON blogs (reviewer_id)');
|
|
$this->addSql('CREATE INDEX idx_blogs_review_status ON blogs (review_status, created_at)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE blogs DROP FOREIGN KEY FK_F41BCA7070574616');
|
|
$this->addSql('DROP INDEX UNIQ_F41BCA70A076FAD7 ON blogs');
|
|
$this->addSql('DROP INDEX IDX_F41BCA7070574616 ON blogs');
|
|
$this->addSql('DROP INDEX idx_blogs_review_status ON blogs');
|
|
$this->addSql('ALTER TABLE blogs DROP sources, DROP review_status, DROP reviewed_at, DROP review_note, DROP topic_slug, DROP reviewer_id');
|
|
}
|
|
}
|