Skip to content

Commit

Permalink
Merge branch 'release/2.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
turegjorup committed Oct 24, 2024
2 parents 9b025ec + a4ab512 commit a8485bf
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 45 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'phpdoc_align' => false,
'no_superfluous_phpdoc_tags' => false,
'array_syntax' => ['syntax' => 'short'],
'phpdoc_to_comment' => false,
'declare_strict_types' => true,
ConstructorEmptyBracesFixer::name() => true,
MultilinePromotedPropertiesFixer::name() => true,
Expand Down
46 changes: 28 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [2.1.2] - 2024-10-24

- [#213](https://github.com/os2display/display-api-service/pull/213)
- Set `phpdoc_to_comment` to `false`in `.php-cs-fixer.dist.php` to avoid breaking psalm ignore
- Add regions and groups to `ScreenInput.php`
- Add "cascade: persist remove" to PlaylistScreenRegion
- Save playlist/regions in `ScreenProcessor.php` and in `src/entity/ScreenLayoutRegions` (as an alternative to sending
multiple requests)
- Save groups in `ScreenProcessor.php` and in `src/entity/tenant/Screen.php`
- Update psalm baseline
- Add regions/playlists and groups to POST screen test
- `composer update symfony/* --with-dependencies`
-
## [2.1.1] - 2024-10-23

- [#217](https://github.com/os2display/display-api-service/pull/217)
Expand All @@ -13,6 +26,7 @@ All notable changes to this project will be documented in this file.

- [#214](https://github.com/os2display/display-api-service/pull/214)
- Updated endSessionUrl to be nullable.

- [#193](https://github.com/os2display/display-api-service/pull/193)
- Adds support for interactive slides.
- Adds interactivity for creating quick bookings from a slide through Microsoft Graph.
Expand Down Expand Up @@ -69,8 +83,8 @@ All notable changes to this project will be documented in this file.
- Changed route prefix to v2.
- [#197](https://github.com/os2display/display-api-service/pull/197)
- Fixed weight issue when assigning slides to playlist.
- [#194](https://github.com/os2display/display-api-service/pull/194)
Updated test run documentation and added test for `rrule` in playlist.
- [#194](https://github.com/os2display/display-api-service/pull/194) Updated test run documentation and added test for
`rrule` in playlist.
- Fixed issue with PlaylistSlide transaction.
- Fixed issues with feed following api platform upgrade.
- [#192](https://github.com/os2display/display-api-service/pull/192)
Expand All @@ -92,8 +106,8 @@ All notable changes to this project will be documented in this file.
- [#184](https://github.com/os2display/display-api-service/pull/184)
- Added RelationsModifiedTrait to serialization groups.
- [#182](https://github.com/os2display/display-api-service/pull/182)
- Changed "Theme" api output to have "Logo" embedded to avoid 404 errors when fetching logo from other shared slide
w. foreign tenant.
- Changed "Theme" api output to have "Logo" embedded to avoid 404 errors when fetching logo from other shared slide w.
foreign tenant.
- [#181](https://github.com/os2display/display-api-service/pull/181)
- Update minimum PHP version to 8.2 to support trait constants
- Add 'relationsModified' timestamps on relevant entities and API resources.
Expand All @@ -114,16 +128,11 @@ All notable changes to this project will be documented in this file.
- Switch from doctrine annotations to attributes
- Add rector as dev dependency and apply rules
- Handle doctrine deprecations
- [#173](https://github.com/os2display/display-api-service/pull/173)
Upgraded to API Platform 3
- [#172](https://github.com/os2display/display-api-service/pull/172)
Linted YAML API resources
- [#171](https://github.com/os2display/display-api-service/pull/171)
Fixed slide playlists collection operation.
- [#170](https://github.com/os2display/display-api-service/pull/170)
Updated Symfony development packages.
- [#165](https://github.com/os2display/display-api-service/pull/165)
Symfony 6.3
- [#173](https://github.com/os2display/display-api-service/pull/173) Upgraded to API Platform 3
- [#172](https://github.com/os2display/display-api-service/pull/172) Linted YAML API resources
- [#171](https://github.com/os2display/display-api-service/pull/171) Fixed slide playlists collection operation.
- [#170](https://github.com/os2display/display-api-service/pull/170) Updated Symfony development packages.
- [#165](https://github.com/os2display/display-api-service/pull/165) Symfony 6.3
- [#162](https://github.com/os2display/display-api-service/pull/162)
- Adds "external" openid-connect provider.
- Renamed "oidc" openid-connect provider to "internal".
Expand All @@ -133,9 +142,9 @@ All notable changes to this project will be documented in this file.
- Upgrades openid-connect bundle to 3.1 to support multiple providers.
- Changes php requirement in composer.json to >= 8.1.
- Removed PHP Upgrade coding standards github actions check.
- Changed user identifier from email to providerId. Made email nullable. Copied value from email to providerId in migration.
- [#161](https://github.com/os2display/display-api-service/pull/161)
Fixed non-entity related psalm errors.
- Changed user identifier from email to providerId. Made email nullable. Copied value from email to providerId in
migration.
- [#161](https://github.com/os2display/display-api-service/pull/161) Fixed non-entity related psalm errors.

## [1.5.0] - 2023-10-26

Expand Down Expand Up @@ -212,7 +221,8 @@ All notable changes to this project will be documented in this file.
- [#138](https://github.com/os2display/display-api-service/pull/138)
- Fixed Tenant and command to allow for empty fallbackImageUrl.
- [#139](https://github.com/os2display/display-api-service/pull/139)
- Changed from service decoration to event listeners to re-enable setting `tenants` on the response from `/v1/authentication/token`.
- Changed from service decoration to event listeners to re-enable setting `tenants` on the response from
`/v1/authentication/token`.
- Ensure same response data from both `/v1/authentication/token` and `/v1/authentication/token/refresh`endpoints.
- Added `user` and `tenants` to JWT payload.

Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,16 @@ the coding standard for the project.

- PHP files [PHP Coding Standards Fixer](https://cs.symfony.com/)

```shell
docker compose exec phpfpm composer coding-standards-check
```
```shell
docker compose exec phpfpm composer coding-standards-check
```

- Markdown files (markdownlint standard rules)

```shell
docker run --rm -v .:/app --workdir=/app node:20 npm install
docker run --rm -v .:/app --workdir=/app node:20 npm run coding-standards-check
```
```shell
docker run --rm -v .:/app --workdir=/app node:20 npm install
docker run --rm -v .:/app --workdir=/app node:20 npm run coding-standards-check
```

#### YAML

Expand All @@ -281,23 +281,24 @@ To attempt to automatically fix coding style issues

- PHP files [PHP Coding Standards Fixer](https://cs.symfony.com/)

```sh
docker compose exec phpfpm composer coding-standards-apply
```
```sh
docker compose exec phpfpm composer coding-standards-apply
```

- Markdown files (markdownlint standard rules)

```shell
docker run --rm -v .:/app --workdir=/app node:18 npm install
docker run --rm -v .:/app --workdir=/app node:18 npm run coding-standards-apply
```
```shell
docker run --rm -v .:/app --workdir=/app node:18 npm install
docker run --rm -v .:/app --workdir=/app node:18 npm run coding-standards-apply
```

## Tests

Run automated tests:

```shell
docker compose exec phpfpm composer tests
docker compose exec phpfpm composer test setup
docker compose exec phpfpm composer test
```

Disable or hide deprecation warnings using the [`SYMFONY_DEPRECATIONS_HELPER` environment
Expand Down
5 changes: 1 addition & 4 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,6 @@
<code><![CDATA[setSize]]></code>
<code><![CDATA[setTitle]]></code>
</PossiblyNullReference>
<UndefinedClass>
<code><![CDATA[InvalidArgumentException]]></code>
</UndefinedClass>
</file>
<file src="src/State/ScreenProvider.php">
<PossiblyNullPropertyAssignmentValue>
Expand Down Expand Up @@ -746,10 +743,10 @@
</NullableReturnStatement>
<PossiblyNullReference>
<code><![CDATA[removeLogo]]></code>
<code><![CDATA[setLogo]]></code>
<code><![CDATA[setCreatedBy]]></code>
<code><![CDATA[setCssStyles]]></code>
<code><![CDATA[setDescription]]></code>
<code><![CDATA[setLogo]]></code>
<code><![CDATA[setModifiedBy]]></code>
<code><![CDATA[setTitle]]></code>
</PossiblyNullReference>
Expand Down
36 changes: 36 additions & 0 deletions public/api-spec-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -11119,6 +11119,24 @@
"boolean",
"null"
]
},
"regions": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"groups": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
}
},
Expand Down Expand Up @@ -11153,6 +11171,24 @@
"boolean",
"null"
]
},
"regions": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"groups": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
}
},
Expand Down
24 changes: 24 additions & 0 deletions public/api-spec-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7735,6 +7735,18 @@ components:
type:
- boolean
- 'null'
regions:
type:
- array
- 'null'
items:
type: string
groups:
type:
- array
- 'null'
items:
type: string
Screen.ScreenInput.jsonld:
type: object
description: ''
Expand All @@ -7758,6 +7770,18 @@ components:
type:
- boolean
- 'null'
regions:
type:
- array
- 'null'
items:
type: string
groups:
type:
- array
- 'null'
items:
type: string
Screen.jsonld:
type: object
description: ''
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/PlaylistScreenRegionDeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __invoke(string $id, string $regionId, string $playlistId): Json
$regionUlid = $this->validationUtils->validateUlid($regionId);
$playlistUlid = $this->validationUtils->validateUlid($playlistId);

$this->playlistScreenRegionRepository->deleteRelations($screenUlid, $regionUlid, $playlistUlid, $this->getActiveTenant());
$this->playlistScreenRegionRepository->deleteRelations($screenUlid, $regionUlid, $playlistUlid);

return new JsonResponse(null, \Symfony\Component\HttpFoundation\Response::HTTP_NO_CONTENT);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Dto/ScreenInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ class ScreenInput
public string $orientation = '';

public ?bool $enableColorSchemeChange = null;
public ?array $regions = null;
public ?array $groups = null;
}
14 changes: 13 additions & 1 deletion src/Entity/ScreenLayoutRegions.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ScreenLayoutRegions extends AbstractBaseEntity implements MultiTenantInter
/**
* @var \Doctrine\Common\Collections\Collection<int, \App\Entity\Tenant\PlaylistScreenRegion>|\App\Entity\Tenant\PlaylistScreenRegion[]
*/
#[ORM\OneToMany(targetEntity: PlaylistScreenRegion::class, mappedBy: 'region', orphanRemoval: true)]
#[ORM\OneToMany(targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], mappedBy: 'region', orphanRemoval: true)]
private Collection $playlistScreenRegions;

public function __construct()
Expand Down Expand Up @@ -82,6 +82,18 @@ public function getPlaylistScreenRegions(): Collection
return $this->playlistScreenRegions;
}

public function setPlaylistScreenRegions(Collection $playlistScreenRegions): void
{
foreach ($this->playlistScreenRegions as $playlistScreenRegion) {
if (false === $playlistScreenRegions->contains($playlistScreenRegion)) {
$this->removePlaylistScreenRegion($playlistScreenRegion);
}
}
foreach ($playlistScreenRegions as $playlistScreenRegion) {
$this->addPlaylistScreenRegion($playlistScreenRegion);
}
}

public function addPlaylistScreenRegion(PlaylistScreenRegion $playlistScreenRegion): self
{
if (!$this->playlistScreenRegions->contains($playlistScreenRegion)) {
Expand Down
16 changes: 14 additions & 2 deletions src/Entity/Tenant/Screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Screen extends AbstractTenantScopedEntity implements RelationsChecksumInte
/**
* @var \Doctrine\Common\Collections\Collection<int, \App\Entity\Tenant\PlaylistScreenRegion>|\App\Entity\Tenant\PlaylistScreenRegion[]
*/
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: PlaylistScreenRegion::class, orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['weight' => \Doctrine\Common\Collections\Order::Ascending->value])]
private Collection $playlistScreenRegions;

Expand Down Expand Up @@ -161,7 +161,7 @@ public function removePlaylistScreenRegion(PlaylistScreenRegion $playlistScreenR

public function removeAllPlaylistScreenRegions(): self
{
foreach ($this->playlistScreenRegions as $playlistScreenRegion) {
foreach ($this->getPlaylistScreenRegions() as $playlistScreenRegion) {
// set the owning side to null (unless already changed)
if ($playlistScreenRegion->getScreen() === $this) {
$playlistScreenRegion->removeScreen();
Expand All @@ -173,6 +173,18 @@ public function removeAllPlaylistScreenRegions(): self
return $this;
}

public function setScreenGroups(Collection $screenGroups): void
{
foreach ($this->screenGroups as $screenGroup) {
if (false === $screenGroups->contains($screenGroup)) {
$this->removeScreenGroup($screenGroup);
}
}
foreach ($screenGroups as $screenGroup) {
$this->addScreenGroup($screenGroup);
}
}

/**
* @return Collection
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Repository/PlaylistScreenRegionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ public function updateRelations(Ulid $screenUlid, Ulid $regionUlid, ArrayCollect
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
*/
public function deleteRelations(Ulid $screenUlid, Ulid $regionUid, Ulid $playlistUlid, Tenant $tenant): void
public function deleteRelations(Ulid $screenUlid, Ulid $regionUid, Ulid $playlistUlid): void
{
$playlistScreenRegion = $this->findOneBy([
'screen' => $screenUlid,
'region' => $regionUid,
'playlist' => $playlistUlid,
'tenant' => $tenant,
]);

if (is_null($playlistScreenRegion)) {
Expand Down
Loading

0 comments on commit a8485bf

Please sign in to comment.