feat: import work hours from SaaS and exchange signed time sheet

This commit is contained in:
fromme committed 2026-09-26 12:13:59 +02:00
1 parent 7cf39850e6
commit 1a7c272414
73 files changed
+10488 -72

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Work months imported from the SaaS time tracking, and the signed Arbeitszeitnachweis that
* belongs to each of them.
*
* Hand-trimmed: doctrine:migrations:diff also produced a long tail of datetime, JSON and
* TINYINT redeclarations across almost every table. That is the long-standing drift between
* the dev database and the mapping, not anything this feature changed, so none of it is here.
*/
final class Version20260921122743 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds teamer_work_month, the SaaS employee id on teamer and the work month relation on upload';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE teamer_work_month (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, year SMALLINT NOT NULL, month SMALLINT NOT NULL, days JSON NOT NULL, total_minutes INT NOT NULL, worked_days INT NOT NULL, absence_days INT NOT NULL, source_ist_minutes INT NOT NULL, status VARCHAR(255) NOT NULL, submitted_at DATETIME DEFAULT NULL, reviewed_at DATETIME DEFAULT NULL, reviewed_by VARCHAR(8) DEFAULT NULL, review_comment LONGTEXT DEFAULT NULL, synced_at DATETIME NOT NULL, warnings JSON DEFAULT NULL, mismatch_detected_at DATETIME DEFAULT NULL, mismatch_total_minutes INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, teamer_id INT NOT NULL, UNIQUE INDEX UNIQ_28857572D17F50A6 (uuid), UNIQUE INDEX teamer_work_month_unique (teamer_id, year, month), INDEX IDX_288575724302FF75 (teamer_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE teamer_work_month ADD CONSTRAINT FK_288575724302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)');
$this->addSql('ALTER TABLE teamer ADD saas_employee_uuid VARCHAR(36) DEFAULT NULL');
$this->addSql('ALTER TABLE upload ADD teamer_work_month_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE upload ADD CONSTRAINT FK_17BDE61FFEAE833A FOREIGN KEY (teamer_work_month_id) REFERENCES teamer_work_month (id)');
$this->addSql('CREATE INDEX IDX_17BDE61FFEAE833A ON upload (teamer_work_month_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE upload DROP FOREIGN KEY FK_17BDE61FFEAE833A');
$this->addSql('DROP INDEX IDX_17BDE61FFEAE833A ON upload');
$this->addSql('ALTER TABLE upload DROP teamer_work_month_id');
$this->addSql('ALTER TABLE teamer DROP saas_employee_uuid');
$this->addSql('ALTER TABLE teamer_work_month DROP FOREIGN KEY FK_288575724302FF75');
$this->addSql('DROP TABLE teamer_work_month');
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* The monthly target and the month's total break time, both shown in the head of the
* Arbeitszeitnachweis next to the hours actually worked.
*
* Hand-trimmed, like Version20260921122743: doctrine:migrations:diff sweeps in the
* long-standing datetime and JSON drift of the dev database, none of which belongs here.
*
* The per-day start, end and break times that go with these live in the existing "days" JSON
* column, so they need no schema change. Rows imported before this migration simply carry
* neither, and are refreshed by the next import of a month that is not yet signed.
*/
final class Version20260921160000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds the monthly target and total break time to teamer_work_month';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE teamer_work_month ADD target_minutes INT DEFAULT 0 NOT NULL, ADD break_minutes INT DEFAULT 0 NOT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE teamer_work_month DROP target_minutes, DROP break_minutes');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* The employee's department, shown in the head of the Arbeitszeitnachweis.
*
* Hand-trimmed like its two predecessors: doctrine:migrations:diff sweeps in the long-standing
* datetime and JSON drift of the dev database, none of which belongs here.
*
* Nullable, and not only because existing rows have none: a month made up entirely of holiday
* carries no booking to read a department from.
*/
final class Version20260921170000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds the department to teamer_work_month';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE teamer_work_month ADD department VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE teamer_work_month DROP department');
}
}