- Implemented TourProgressController to handle API endpoints for tracking guided tours seen by users. - Created UserTourProgress entity to store the highest version of tours seen by each user. - Developed UserTourProgressRepository for database interactions related to user tour progress. - Introduced TourProgressService to manage business logic for marking tours as seen and retrieving seen maps. - Added comprehensive tests for API endpoints and entity behavior to ensure functionality and data integrity.
32 lines
1.2 KiB
PHP
32 lines
1.2 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 Version20260810052544 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Per-user progress of the admin panel guided tours';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('CREATE TABLE user_tour_progress (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, tour_id VARCHAR(64) NOT NULL, version INT NOT NULL, seen_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_56700625D17F50A6 (uuid), INDEX IDX_56700625A76ED395 (user_id), UNIQUE INDEX uniq_user_tour (user_id, tour_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
|
$this->addSql('ALTER TABLE user_tour_progress ADD CONSTRAINT FK_56700625A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE user_tour_progress DROP FOREIGN KEY FK_56700625A76ED395');
|
|
$this->addSql('DROP TABLE user_tour_progress');
|
|
}
|
|
}
|