Files
clinicpro/migrations/Version20260730060615.php
hamed 57aeb40934 feat: add staff role functionality with dashboard access and service management
- Implemented SidebarStaff component tests to ensure staff users see only their dashboard and services.
- Created StaffMyServicesPage to display assigned services for staff users.
- Added migration to link clinic staff rows to user accounts for ROLE_STAFF access.
- Defined StaffPermissions class for static permissions related to staff role.
- Introduced StaffRouteGuardSubscriber to restrict API access for staff users.
- Developed StaffAccountService for managing staff user accounts and linking them to clinic staff.
- Added comprehensive tests for StaffAccountService to validate user creation, mobile number handling, and account attachment.
- Implemented tests for staff dashboard access to ensure proper permissions and access control.
- Created tests for staff login context to verify correct environment visibility based on user roles.
2026-07-30 10:18:41 +03:30

36 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 Version20260730060615 extends AbstractMigration
{
public function getDescription(): string
{
return 'Link clinic_staff rows to a login account (users.id) for the ROLE_STAFF panel access.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE clinic_staff ADD user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE clinic_staff ADD CONSTRAINT FK_CBEA5AA1A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_CBEA5AA1A76ED395 ON clinic_staff (user_id)');
$this->addSql('CREATE INDEX idx_staff_user_active ON clinic_staff (user_id, active)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE clinic_staff DROP FOREIGN KEY FK_CBEA5AA1A76ED395');
$this->addSql('DROP INDEX IDX_CBEA5AA1A76ED395 ON clinic_staff');
$this->addSql('DROP INDEX idx_staff_user_active ON clinic_staff');
$this->addSql('ALTER TABLE clinic_staff DROP user_id');
}
}