Skip to content

Commit

Permalink
Merge pull request #182 from aroskanalen/feature/#161_fix_404_on_shar…
Browse files Browse the repository at this point in the history
…ed_images

#161: Changed "Theme" api output to have "Logo" embedded to avoid 404 errors
  • Loading branch information
turegjorup authored Jan 12, 2024
2 parents 724ab88 + 8b4c824 commit b15bd6a
Show file tree
Hide file tree
Showing 15 changed files with 578 additions and 180 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#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.
- [#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 Down
72 changes: 38 additions & 34 deletions config/api_platform/theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ resources:

operations:
ApiPlatform\Metadata\Get: &get
normalizationContext:
groups: ['theme:read']
openapiContext:
description: Retrieves a Theme resource.
summary: Retrieve a Theme resource.
Expand All @@ -31,41 +33,9 @@ resources:
examples:
headers: {}

ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_ADMIN")'
openapiContext:
description: Update a Theme resource.
summary: Update a Theme resource.
operationId: put-v1-theme-id
tags:
- Themes
parameters:
- schema:
type: string
format: ulid
pattern: "^[A-Za-z0-9]{26}$"
name: id
in: path
required: true

ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_ADMIN")'
openapiContext:
description: Delete a Theme resource.
summary: Delete a Theme resource.
operationId: delete-v1-theme-id
tags:
- Themes
parameters:
- schema:
type: string
format: ulid
pattern: "^[A-Za-z0-9]{26}$"
name: id
in: path
required: true

ApiPlatform\Metadata\GetCollection:
normalizationContext:
groups: ['theme:read']
filters:
- 'entity.search_filter'
- 'entity.blameable_filter'
Expand Down Expand Up @@ -100,6 +70,40 @@ resources:
examples:
headers: {}

ApiPlatform\Metadata\Put:
security: 'is_granted("ROLE_ADMIN")'
openapiContext:
description: Update a Theme resource.
summary: Update a Theme resource.
operationId: put-v1-theme-id
tags:
- Themes
parameters:
- schema:
type: string
format: ulid
pattern: "^[A-Za-z0-9]{26}$"
name: id
in: path
required: true

ApiPlatform\Metadata\Delete:
security: 'is_granted("ROLE_ADMIN")'
openapiContext:
description: Delete a Theme resource.
summary: Delete a Theme resource.
operationId: delete-v1-theme-id
tags:
- Themes
parameters:
- schema:
type: string
format: ulid
pattern: "^[A-Za-z0-9]{26}$"
name: id
in: path
required: true

ApiPlatform\Metadata\Post:
security: 'is_granted("ROLE_ADMIN")'
openapiContext:
Expand Down
1 change: 1 addition & 0 deletions fixtures/theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ App\Entity\Tenant\Theme:
description: <text()>
slides: ['@slide_abc_1', '@slide_abc_2', '@slide_abc_3', '@slide_abc_4', '@slide_abc_5']
tenant: '@tenant_abc'
logo: '@media_abc_1'
cssStyles: "
/*
* Example theme file
Expand Down
35 changes: 35 additions & 0 deletions migrations/Version20240110091802.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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 Version20240110091802 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('DROP INDEX relations_modified_at_idx ON theme');
$this->addSql('DROP INDEX modified_at_idx ON theme');
$this->addSql('ALTER TABLE theme DROP relations_modified_at, DROP relations_modified');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE theme ADD relations_modified_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD relations_modified JSON DEFAULT \'{}\' NOT NULL COMMENT \'(DC2Type:json)\'');
$this->addSql('CREATE INDEX relations_modified_at_idx ON theme (relations_modified_at)');
$this->addSql('CREATE INDEX modified_at_idx ON theme (modified_at)');
}
}
Loading

0 comments on commit b15bd6a

Please sign in to comment.