Skip to content

Commit 254cdce

Browse files
authored
Merge pull request #210 from aroskanalen/feature/366-quick-book
Slide Interaction - Calendar Instant Booking
2 parents a6ee440 + da336bc commit 254cdce

25 files changed

+1269
-19
lines changed

.env

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,25 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
4141
###> App ###
4242
APP_DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
4343
APP_ACTIVATION_CODE_EXPIRE_INTERNAL=P2D
44+
APP_KEY_VAULT_SOURCE=ENVIRONMENT
45+
APP_KEY_VAULT_JSON="{}"
4446
###< App ###
4547

4648
###> lexik/jwt-authentication-bundle ###
4749
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
4850
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
4951
JWT_PASSPHRASE=APP_JWT_PASSPHRASE
50-
JWT_TOKEN_TTL=3600 # 1 hour
51-
JWT_SCREEN_TOKEN_TTL=1296000 # 15 days
52+
# 1 hour
53+
JWT_TOKEN_TTL=3600
54+
# 15 days
55+
JWT_SCREEN_TOKEN_TTL=1296000
5256
###< lexik/jwt-authentication-bundle ###
5357

5458
###> gesdinet/jwt-refresh-token-bundle ###
55-
JWT_REFRESH_TOKEN_TTL=7200 # 2 hours
56-
JWT_SCREEN_REFRESH_TOKEN_TTL=2592000 # 30 days
59+
# 2 hours
60+
JWT_REFRESH_TOKEN_TTL=7200
61+
# 30 days
62+
JWT_SCREEN_REFRESH_TOKEN_TTL=2592000
5763
###< gesdinet/jwt-refresh-token-bundle ###
5864

5965
###> itk-dev/openid-connect-bundle ###
@@ -75,6 +81,7 @@ EXTERNAL_OIDC_REDIRECT_URI=EXTERNAL_OIDC_REDIRECT_URI
7581
EXTERNAL_OIDC_LEEWAY=30
7682
EXTERNAL_OIDC_HASH_SALT=
7783
EXTERNAL_OIDC_CLAIM_ID=signinname
84+
###< itk-dev/openid-connect-bundle ###
7885

7986
# cli redirect url
8087
OIDC_CLI_REDIRECT=APP_CLI_REDIRECT_URI
@@ -84,3 +91,4 @@ OIDC_CLI_REDIRECT=APP_CLI_REDIRECT_URI
8491
REDIS_CACHE_PREFIX=DisplayApiService
8592
REDIS_CACHE_DSN=redis://redis:6379/0
8693
###< redis ###
94+

.env.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ DATABASE_URL="mysql://root:password@mariadb:3306/db_test?serverVersion=mariadb-1
1111
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
1212
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
1313
JWT_PASSPHRASE=APP_JWT_PASSPHRASE
14-
JWT_TOKEN_TTL=1800 # 30 min
15-
JWT_SCREEN_TOKEN_TTL=43200 # 12 hours
14+
JWT_TOKEN_TTL=1800
15+
JWT_SCREEN_TOKEN_TTL=43200
1616
###< lexik/jwt-authentication-bundle ###
1717

1818
###> gesdinet/jwt-refresh-token-bundle ###
19-
JWT_REFRESH_TOKEN_TTL=3600 # 1 hour
20-
JWT_SCREEN_REFRESH_TOKEN_TTL=86400 # 24 hours
19+
JWT_REFRESH_TOKEN_TTL=3600
20+
JWT_SCREEN_REFRESH_TOKEN_TTL=86400
2121
###< gesdinet/jwt-refresh-token-bundle ###

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- [#193](https://github.com/os2display/display-api-service/pull/193)
8+
- Adds support for interactive slides.
9+
- Adds interactivity for creating quick bookings from a slide through Microsoft Graph.
10+
- Adds KeyVaultService that can serve key-value entries from the environment for storing secrets.
11+
712
## [2.0.6] - 2024-06-28
813

914
- [#208](https://github.com/os2display/display-api-service/pull/208)

config/api_platform/slide.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,26 @@ resources:
108108
tags:
109109
- Slides
110110

111+
_api_Slide_perform_action:
112+
input: App\Dto\InteractiveSlideActionInput
113+
class: ApiPlatform\Metadata\POST
114+
method: POST
115+
uriTemplate: '/slides/{id}/action'
116+
controller: App\Controller\InteractiveController
117+
openapiContext:
118+
description: Perform an action for a slide.
119+
summary: Performs an action for a slide.
120+
tags:
121+
- Slides
122+
parameters:
123+
- schema:
124+
type: string
125+
format: ulid
126+
pattern: "^[A-Za-z0-9]{26}$"
127+
name: id
128+
in: path
129+
required: true
130+
111131
# Our DTO must be a resource to get a proper URL
112132
# @see https://stackoverflow.com/a/75705084
113133
# @see https://github.com/api-platform/core/issues/5451

config/packages/cache.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ framework:
2222
adapter: cache.adapter.redis
2323
# Default expire set to 1 day
2424
default_lifetime: 86400
25+
26+
# Creates a "interactive_slide.cache" service
27+
interactive_slide.cache:
28+
adapter: cache.adapter.redis
29+
# Default expire set to 12 hours
30+
default_lifetime: 43200

config/packages/dev/monolog.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ monolog:
55
path: "%kernel.logs_dir%/%kernel.environment%.log"
66
level: debug
77
channels: ["!event", "!doctrine", "!deprecation"]
8+
# uncomment to get logging in your browser
9+
# you may have to allow bigger header sizes in your Web server configuration
10+
#firephp:
11+
# type: firephp
12+
# level: info
13+
#chromephp:
14+
# type: chromephp
15+
# level: info
816
console:
917
type: console
1018
process_psr_3_messages: false

config/services.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ services:
3030
- { name: api_platform.doctrine.orm.query_extension.collection }
3131
- { name: api_platform.doctrine.orm.query_extension.item }
3232

33+
App\InteractiveSlide\InteractiveSlideInterface:
34+
tags: [app.interactive.interactive]
35+
3336
# Specify primary UserProviderInterface
3437
Symfony\Component\Security\Core\User\UserProviderInterface: '@security.user.provider.concrete.app_user_provider'
3538

@@ -48,6 +51,11 @@ services:
4851
Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface: '@Lexik\Bundle\JWTAuthenticationBundle\Security\Http\Authentication\AuthenticationFailureHandler'
4952
Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface: '@Lexik\Bundle\JWTAuthenticationBundle\Security\Http\Authentication\AuthenticationSuccessHandler'
5053

54+
App\Service\KeyVaultService:
55+
arguments:
56+
$keyVaultSource: '%env(string:APP_KEY_VAULT_SOURCE)%'
57+
$keyVaultArray: '%env(json:APP_KEY_VAULT_JSON)%'
58+
5159
App\Service\UserService:
5260
arguments:
5361
$hashSalt: '%env(EXTERNAL_OIDC_HASH_SALT)%'
@@ -81,6 +89,10 @@ services:
8189
arguments:
8290
- !tagged_iterator app.feed.feed_type
8391

92+
App\Service\InteractiveSlideService:
93+
arguments:
94+
- !tagged_iterator app.interactive.interactive
95+
8496
App\Security\ScreenAuthenticator:
8597
arguments:
8698
$jwtScreenRefreshTokenTtl: '%env(int:JWT_SCREEN_REFRESH_TOKEN_TTL)%'

migrations/Version20240403043527.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20240403043527 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('CREATE TABLE interactive_slide (id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', tenant_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', version INT DEFAULT 1 NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by VARCHAR(255) DEFAULT \'\' NOT NULL, modified_by VARCHAR(255) DEFAULT \'\' NOT NULL, configuration JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', implementation_class VARCHAR(255) NOT NULL, INDEX IDX_138E544D9033212A (tenant_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
24+
$this->addSql('ALTER TABLE interactive_slide ADD CONSTRAINT FK_138E544D9033212A FOREIGN KEY (tenant_id) REFERENCES tenant (id)');
25+
}
26+
27+
public function down(Schema $schema): void
28+
{
29+
// this down() migration is auto-generated, please modify it to your needs
30+
$this->addSql('ALTER TABLE interactive_slide DROP FOREIGN KEY FK_138E544D9033212A');
31+
$this->addSql('DROP TABLE interactive_slide');
32+
}
33+
}

psalm-baseline.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,10 @@
495495
</UndefinedDocblockClass>
496496
</file>
497497
<file src="src/Feed/KobaFeedType.php">
498-
<InvalidThrow>
499-
<code><![CDATA[throw new MissingFeedConfigurationException('Koba event_name is not string');]]></code>
500-
</InvalidThrow>
501498
<RiskyTruthyFalsyComparison>
502499
<code><![CDATA[$filterList]]></code>
503500
<code><![CDATA[$rewriteBookedTitles]]></code>
504501
</RiskyTruthyFalsyComparison>
505-
<UndefinedClass>
506-
<code><![CDATA[MissingFeedConfigurationException]]></code>
507-
</UndefinedClass>
508502
</file>
509503
<file src="src/Feed/SparkleIOFeedType.php">
510504
<UndefinedInterfaceMethod>

public/api-spec-v2.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5039,6 +5039,86 @@
50395039
},
50405040
"parameters": []
50415041
},
5042+
"/v2/slides/{id}/action": {
5043+
"post": {
5044+
"operationId": "api_Slide_perform_action",
5045+
"tags": [
5046+
"Slides"
5047+
],
5048+
"responses": {
5049+
"201": {
5050+
"description": "Slide resource created",
5051+
"content": {
5052+
"application/ld+json": {
5053+
"schema": {
5054+
"$ref": "#/components/schemas/Slide.Slide.jsonld"
5055+
}
5056+
},
5057+
"text/html": {
5058+
"schema": {
5059+
"$ref": "#/components/schemas/Slide.Slide"
5060+
}
5061+
},
5062+
"multipart/form-data": {
5063+
"schema": {
5064+
"$ref": "#/components/schemas/Slide.Slide"
5065+
}
5066+
}
5067+
},
5068+
"links": {}
5069+
},
5070+
"400": {
5071+
"description": "Invalid input"
5072+
},
5073+
"422": {
5074+
"description": "Unprocessable entity"
5075+
}
5076+
},
5077+
"summary": "Performs an action for a slide.",
5078+
"description": "Perform an action for a slide.",
5079+
"parameters": [
5080+
{
5081+
"name": "id",
5082+
"in": "path",
5083+
"description": "",
5084+
"required": true,
5085+
"deprecated": false,
5086+
"allowEmptyValue": false,
5087+
"schema": {
5088+
"type": "string",
5089+
"format": "ulid",
5090+
"pattern": "^[A-Za-z0-9]{26}$"
5091+
},
5092+
"style": "simple",
5093+
"explode": false,
5094+
"allowReserved": false
5095+
}
5096+
],
5097+
"requestBody": {
5098+
"description": "The new Slide resource",
5099+
"content": {
5100+
"application/ld+json": {
5101+
"schema": {
5102+
"$ref": "#/components/schemas/Slide.InteractiveSlideActionInput.jsonld"
5103+
}
5104+
},
5105+
"text/html": {
5106+
"schema": {
5107+
"$ref": "#/components/schemas/Slide.InteractiveSlideActionInput"
5108+
}
5109+
},
5110+
"multipart/form-data": {
5111+
"schema": {
5112+
"$ref": "#/components/schemas/Slide.InteractiveSlideActionInput"
5113+
}
5114+
}
5115+
},
5116+
"required": true
5117+
},
5118+
"deprecated": false
5119+
},
5120+
"parameters": []
5121+
},
50425122
"/v2/slides/{id}/playlists": {
50435123
"get": {
50445124
"operationId": "put-v2-slide-playlist-id",
@@ -13102,6 +13182,44 @@
1310213182
}
1310313183
}
1310413184
},
13185+
"Slide.InteractiveSlideActionInput": {
13186+
"type": "object",
13187+
"description": "",
13188+
"deprecated": false,
13189+
"properties": {
13190+
"action": {
13191+
"type": [
13192+
"string",
13193+
"null"
13194+
]
13195+
},
13196+
"data": {
13197+
"type": "array",
13198+
"items": {
13199+
"type": "string"
13200+
}
13201+
}
13202+
}
13203+
},
13204+
"Slide.InteractiveSlideActionInput.jsonld": {
13205+
"type": "object",
13206+
"description": "",
13207+
"deprecated": false,
13208+
"properties": {
13209+
"action": {
13210+
"type": [
13211+
"string",
13212+
"null"
13213+
]
13214+
},
13215+
"data": {
13216+
"type": "array",
13217+
"items": {
13218+
"type": "string"
13219+
}
13220+
}
13221+
}
13222+
},
1310513223
"Slide.Slide": {
1310613224
"type": "object",
1310713225
"description": "",

0 commit comments

Comments
 (0)