Skip to content

Commit

Permalink
Expose l'identifiant arrêté dans le DATEX (#785)
Browse files Browse the repository at this point in the history
* Expose l'identifiant arrêté dans le DATEX

* Include organization uuid
  • Loading branch information
florimondmanca authored May 22, 2024
1 parent 0ca8af0 commit 96cc4b0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function __invoke(GetRegulationOrdersToDatexFormatQuery $query): array

$regulationOrderViews[] = new RegulationOrderDatexListItemView(
uuid: $regulationOrder->getUuid(),
regulationId: $regulationOrder->getIdentifier() . '#' . $regulationOrderRecord->getOrganizationUuid(),
organization: $regulationOrderRecord->getOrganizationName(),
description: $regulationOrder->getDescription(),
startDate: $regulationOrder->getStartDate(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace App\Application\Regulation\View;

final class RegulationOrderDatexListItemView
final readonly class RegulationOrderDatexListItemView
{
public function __construct(
public readonly string $uuid,
public readonly string $organization,
public readonly string $description,
public readonly ?\DateTimeInterface $startDate,
public readonly ?\DateTimeInterface $endDate,
public readonly array $trafficRegulations,
public string $uuid,
public string $regulationId,
public string $organization,
public string $description,
public ?\DateTimeInterface $startDate,
public ?\DateTimeInterface $endDate,
public array $trafficRegulations,
) {
}
}
2 changes: 1 addition & 1 deletion templates/api/regulations.xml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<com:value>{{ regulationOrder.organization }}</com:value>
</com:values>
</issuingAuthority>
<regulationId>{{ regulationOrder.uuid }}</regulationId>
<regulationId>{{ regulationOrder.regulationId }}</regulationId>
<status>madeAndImplemented</status>

<validityByOrder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
<com:value>Main Org</com:value>
</com:values>
</issuingAuthority>
<regulationId>06549047-db9d-74bb-8000-754a6f2ff4c3</regulationId>
<regulationId>F/CIFS/2021#e0d93630-acf7-4722-81e8-ff7d5fa64b66</regulationId>
<status>madeAndImplemented</status>

<validityByOrder>
Expand Down Expand Up @@ -567,7 +567,7 @@
<com:value>Main Org</com:value>
</com:values>
</issuingAuthority>
<regulationId>2e5eb289-90c8-4c3f-8e7c-2e9e7de8948c</regulationId>
<regulationId>FO2/2023#e0d93630-acf7-4722-81e8-ff7d5fa64b66</regulationId>
<status>madeAndImplemented</status>

<validityByOrder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,18 @@ public function testGetAll(): void
->expects(self::once())
->method('getUuid')
->willReturn('247edaa2-58d1-43de-9d33-9753bf6f4d30');
$regulationOrder1
->expects(self::once())
->method('getIdentifier')
->willReturn('F01/2024');
$regulationOrderRecord1
->expects(self::once())
->method('getOrganizationName')
->willReturn('Autorité 1');
$regulationOrderRecord1
->expects(self::once())
->method('getOrganizationUuid')
->willReturn('56456ff6-7e1c-4d24-aa09-9c650d7f6115');
$regulationOrder1
->expects(self::once())
->method('getDescription')
Expand Down Expand Up @@ -317,10 +325,18 @@ public function testGetAll(): void
->expects(self::once())
->method('getUuid')
->willReturn('3d1c6ec7-28f5-4b6b-be71-b0920e85b4bf');
$regulationOrder2
->expects(self::once())
->method('getIdentifier')
->willReturn('F02/2024');
$regulationOrderRecord2
->expects(self::once())
->method('getOrganizationName')
->willReturn('Autorité 2');
$regulationOrderRecord2
->expects(self::once())
->method('getOrganizationUuid')
->willReturn('df1895bf-17af-4d68-adbd-02a7110d3b29');
$regulationOrder2
->expects(self::once())
->method('getDescription')
Expand Down Expand Up @@ -426,10 +442,18 @@ public function testGetAll(): void
->expects(self::once())
->method('getUuid')
->willReturn('12410fb8-a2b9-4449-a7d5-a4f409807f99');
$regulationOrder3
->expects(self::once())
->method('getIdentifier')
->willReturn('F03/2024');
$regulationOrderRecord3
->expects(self::once())
->method('getOrganizationName')
->willReturn('Autorité 3');
$regulationOrderRecord3
->expects(self::once())
->method('getOrganizationUuid')
->willReturn('fde674d4-9e82-42f5-841d-13f7d20b43e0');
$regulationOrder3
->expects(self::once())
->method('getDescription')
Expand Down Expand Up @@ -531,6 +555,7 @@ public function testGetAll(): void
[
new RegulationOrderDatexListItemView(
uuid: '247edaa2-58d1-43de-9d33-9753bf6f4d30',
regulationId: 'F01/2024#56456ff6-7e1c-4d24-aa09-9c650d7f6115',
organization: 'Autorité 1',
description: 'Description 1',
startDate: $startDate1,
Expand All @@ -555,6 +580,7 @@ public function testGetAll(): void
),
new RegulationOrderDatexListItemView(
uuid: '3d1c6ec7-28f5-4b6b-be71-b0920e85b4bf',
regulationId: 'F02/2024#df1895bf-17af-4d68-adbd-02a7110d3b29',
organization: 'Autorité 2',
description: 'Description 2',
startDate: $startDate2,
Expand Down Expand Up @@ -582,6 +608,7 @@ public function testGetAll(): void
),
new RegulationOrderDatexListItemView(
uuid: '12410fb8-a2b9-4449-a7d5-a4f409807f99',
regulationId: 'F03/2024#fde674d4-9e82-42f5-841d-13f7d20b43e0',
organization: 'Autorité 3',
description: 'Description 3',
startDate: $startDate3,
Expand Down

0 comments on commit 96cc4b0

Please sign in to comment.