Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Oct 28, 2024
1 parent d5feb8f commit 6f461f9
Show file tree
Hide file tree
Showing 33 changed files with 1,070 additions and 455 deletions.
31 changes: 31 additions & 0 deletions databox/api/migrations/Version20241028171322.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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 Version20241028171322 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE job_state ADD number SMALLINT NOT NULL DEFAULT 0');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE job_state DROP number');
}
}
5 changes: 5 additions & 0 deletions databox/api/src/Controller/Admin/JobStateCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Filter\ChoiceFilter;
use EasyCorp\Bundle\EasyAdminBundle\Filter\DateTimeFilter;
use EasyCorp\Bundle\EasyAdminBundle\Filter\NumericFilter;
use EasyCorp\Bundle\EasyAdminBundle\Filter\TextFilter;
use Symfony\Component\HttpFoundation\RedirectResponse;

class JobStateCrudController extends AbstractAdminCrudController
Expand Down Expand Up @@ -109,6 +112,7 @@ public function configureFilters(Filters $filters): Filters
->add(AssociationIdentifierFilter::new('workflow'))
->add(DateTimeFilter::new('startedAt'))
->add(DateTimeFilter::new('endedAt'))
->add(NumericFilter::new('number'))
;
}

Expand All @@ -119,6 +123,7 @@ public function configureFields(string $pageName): iterable
yield TextField::new('jobId', 'Job ID');
yield DateTimeField::new('triggeredAt', 'Triggered At');
yield DateTimeField::new('startedAt', 'Started At');
yield NumberField::new('number');
yield ChoiceField::new('status', 'Status')
->setChoices([
'TRIGGERED' => ModelJobState::STATUS_TRIGGERED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testApiV3SubDefIsTriggered(): void
$envelope = $inMemoryTransport->get()[0];
$eventMessage = $envelope->getMessage();
self::assertInstanceOf(JobConsumer::class, $eventMessage);
self::assertEquals(PhraseanetRenditionIntegration::getName().':'.$integration->getId().':api', $eventMessage->getJobId());
self::assertEquals(PhraseanetRenditionIntegration::getName().':'.$integration->getId().':api', $eventMessage->getJobStateId());
$this->consumeEvent($envelope);

self::assertEquals('POST', $mockResponse->getRequestMethod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testEnqueueIsTriggered(): void
$eventMessage = $envelope->getMessage();
self::assertInstanceOf(JobConsumer::class, $eventMessage);
$workflowId = $eventMessage->getWorkflowId();
self::assertEquals(PhraseanetRenditionIntegration::getName().':'.$integration->getId().':enqueue', $eventMessage->getJobId());
self::assertEquals(PhraseanetRenditionIntegration::getName().':'.$integration->getId().':enqueue', $eventMessage->getJobStateId());
$this->consumeEvent($envelope);

self::assertEquals('POST', $mockResponse->getRequestMethod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ Alchemy\Workflow\Doctrine\Entity\JobState:
name: status
type: smallint
nullable: false
number:
name: status
type: smallint
nullable: false
11 changes: 6 additions & 5 deletions lib/php/workflow/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@
"require": {
"php": "^8.3",
"ext-json": "*",
"symfony/console": "^5.4 || ^6",
"symfony/yaml": "^6.2",
"symfony/console": "^5.4 || ^6 || ^7",
"symfony/yaml": "^6.2 || ^7",
"ramsey/uuid": "^4.2",
"symfony/process": "^6.3",
"symfony/expression-language": "^5.2 || ^6.2",
"symfony/property-access": "^5.2 || ^6.2"
"symfony/process": "^6.3 || ^7",
"symfony/expression-language": "^5.2 || ^6.2 || ^7",
"symfony/property-access": "^5.2 || ^6.2 || ^7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.17",
"phpunit/phpunit": "^9.5",
"symfony/http-kernel": "^6 || ^7",
"symfony/var-dumper": "^5.4",
"doctrine/orm": "^2.14",
"symfony/messenger": "^6.4",
Expand Down
Loading

0 comments on commit 6f461f9

Please sign in to comment.