Skip to content

Commit

Permalink
feat(ZMS-3459): return slotTimeInMinutes
Browse files Browse the repository at this point in the history
  • Loading branch information
manjencic committed Jan 20, 2025
1 parent 0536043 commit 32bad2e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zmscitizenapi/src/Zmscitizenapi/Models/Office.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class Office extends Entity implements JsonSerializable
/** @var string|null */
public ?string $organizationUnit = null;

/** @var int|null */
public ?int $slotTimeInMinutes = null;

/** @var array|null */
public ?array $geo = null;

Expand All @@ -43,6 +46,7 @@ public function __construct(
?array $displayNameAlternatives = null,
?string $organization = null,
?string $organizationUnit = null,
?int $slotTimeInMinutes = null,
?array $geo = null,
?ThinnedScope $scope = null
) {
Expand All @@ -52,6 +56,7 @@ public function __construct(
$this->displayNameAlternatives = $displayNameAlternatives;
$this->organization = $organization;
$this->organizationUnit = $organizationUnit;
$this->slotTimeInMinutes = $slotTimeInMinutes;
$this->geo = $geo;
$this->scope = $scope;

Expand Down Expand Up @@ -79,6 +84,7 @@ public function toArray(): array
'displayNameAlternatives' => $this->displayNameAlternatives,
'organization' => $this->organization,
'organizationUnit' => $this->organizationUnit,
'slotTimeInMinutes' => $this->slotTimeInMinutes,
'geo' => $this->geo,
'scope' => $this->scope?->toArray(),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static function mapOfficesWithScope(ProviderList $providerList): OfficeLi
displayNameAlternatives: $provider->data['displayNameAlternatives'] ?? [],
organization: $provider->data['organization'] ?? null,
organizationUnit: $provider->data['organizationUnit'] ?? null,
slotTimeInMinutes: $provider->data['slotTimeInMinutes'] ?? null,
geo: isset($provider->data['geo']) ? $provider->data['geo'] : null,
scope: isset($providerScope) && !isset($providerScope['errors']) ? new ThinnedScope(
id: isset($providerScope->id) ? (int) $providerScope->id : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static function getOffices(): OfficeList
displayNameAlternatives: $provider->data['displayNameAlternatives'] ?? [],
organization: $provider->data['organization'] ?? null,
organizationUnit: $provider->data['organizationUnit'] ?? null,
slotTimeInMinutes: $provider->data['slotTimeInMinutes'] ?? null,
geo: $provider->data['geo'] ?? null,
scope: $matchingScope ? new ThinnedScope(
id: (int) $matchingScope->id,
Expand Down Expand Up @@ -373,6 +374,7 @@ public static function getOfficesThatProvideService(int $serviceId): OfficeList|
displayNameAlternatives: $provider->data['displayNameAlternatives'] ?? [],
organization: $provider->data['organization'] ?? null,
organizationUnit: $provider->data['organizationUnit'] ?? null,
slotTimeInMinutes: $provider->data['slotTimeInMinutes'] ?? null,
geo: $provider->data['geo'] ?? null,
scope: $scope instanceof ThinnedScope ? $scope : null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testRendering()
"displayNameAlternatives" => null,
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => null,
"scope" => [
"id" => 2,
Expand Down Expand Up @@ -104,6 +105,7 @@ public function testRenderingRequestRelation()
"displayNameAlternatives" => null,
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => null,
"scope" => [
"id" => 1,
Expand Down Expand Up @@ -140,6 +142,7 @@ public function testRenderingRequestRelation()
"displayNameAlternatives" => null,
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => null,
"scope" => [
"id" => 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function testRendering()
"displayNameAlternatives" => [],
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => [
"lat" => "48.12750898398659",
"lon" => "11.604317899956524"
Expand Down Expand Up @@ -83,6 +84,7 @@ public function testRendering()
"displayNameAlternatives" => [],
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => [
"lat" => "48.12750898398659",
"lon" => "11.604317899956524"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function testRendering()
"displayNameAlternatives" => [],
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => [
"lat" => "48.12750898398659",
"lon" => "11.604317899956524"
Expand Down Expand Up @@ -83,6 +84,7 @@ public function testRendering()
"displayNameAlternatives" => [],
"organization" => null,
"organizationUnit" => null,
"slotTimeInMinutes" => null,
"geo" => [
"lat" => "48.12750898398659",
"lon" => "11.604317899956524"
Expand Down
4 changes: 4 additions & 0 deletions zmsentities/schema/citizenapi/collections/officeList.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
"type": ["string", "null"],
"description": "The name of the organization"
},
"slotTimeInMinutes": {
"type": ["integer", "null"],
"description": "Slot time in minutes"
},
"geo": {
"type": [
"array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
"type": ["string", "null"],
"description": "The name of the organization"
},
"slotTimeInMinutes": {
"type": ["integer", "null"],
"description": "Slot time in minutes"
},
"geo": {
"type": [
"array",
Expand Down
4 changes: 4 additions & 0 deletions zmsentities/schema/citizenapi/office.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"type": ["string", "null"],
"description": "The name of the organization"
},
"slotTimeInMinutes": {
"type": ["integer", "null"],
"description": "Slot time in minutes"
},
"geo": {
"type": ["array", "object", "null"],
"description": "Geographical coordinates of the office",
Expand Down

0 comments on commit 32bad2e

Please sign in to comment.