Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status status #227

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###> App ###
APP_DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
APP_ACTIVATION_CODE_EXPIRE_INTERNAL=P2D
APP_TRACK_SCREEN_INFO=false
APP_TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
APP_KEY_VAULT_SOURCE=ENVIRONMENT
APP_KEY_VAULT_JSON="{}"
###< App ###
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#229](https://github.com/os2display/display-api-service/pull/229)
- Added screen status to cache and endpoint for exposing screen status.
- [#225](https://github.com/os2display/display-api-service/pull/225)
- Added ADRs.
- [#215](https://github.com/os2display/display-api-service/pull/215)
Expand Down
3 changes: 2 additions & 1 deletion config/api_platform/screen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ resources:
ApiPlatform\Metadata\GetCollection:
filters:
- 'App\Filter\MultipleSearchFilter'
- 'screen.screen_user_exists_filter'
- 'screen.screen_user_latest_request_filter'
- 'entity.blameable_filter'
- 'entity.order_filter'
- 'created.at.order_filter'
Expand Down Expand Up @@ -100,7 +102,6 @@ resources:
content:
application/ld+json:
examples:

headers: {}

ApiPlatform\Metadata\Post:
Expand Down
6 changes: 6 additions & 0 deletions config/packages/cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ framework:
# Default expire set to 1 day
default_lifetime: 86400

# Creates a "screen.status.cache" service ($screenStatusCache)
screen.status.cache:
adapter: cache.adapter.redis
# Default expire set to infinity
default_lifetime: 0

# Creates an "interactive_slide.cache" service
interactive_slide.cache:
adapter: cache.adapter.redis
Expand Down
3 changes: 3 additions & 0 deletions config/packages/test/cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ framework:
auth.screen.cache:
adapter: cache.adapter.filesystem
default_lifetime: 3600
screen.status.cache:
adapter: cache.adapter.filesystem
default_lifetime: 0
12 changes: 12 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ services:
# @see https://api-platform.com/docs/core/state-processors/#hooking-into-the-built-in-state-processors
$persistProcessor: '@api_platform.doctrine.orm.state.persist_processor'
$removeProcessor: '@api_platform.doctrine.orm.state.remove_processor'
$trackScreenInfo: '%env(bool:APP_TRACK_SCREEN_INFO)%'
$trackScreenInfoUpdateIntervalSeconds: '%env(APP_TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS)%'

_instanceof:
App\Feed\FeedTypeInterface:
Expand Down Expand Up @@ -295,6 +297,16 @@ services:
tags: ['api_platform.filter']
arguments: [ { fullName: 'partial', email: 'partial' } ]

screen.screen_user_exists_filter:
parent: 'api_platform.doctrine.orm.exists_filter'
tags: ['api_platform.filter']
arguments: [ { screenUser: ~ } ]

screen.screen_user_latest_request_filter:
parent: 'api_platform.doctrine.orm.date_filter'
tags: ['api_platform.filter']
arguments: [ { screenUser.latestRequest: ~ } ]

# App filters for Api Platform
App\Filter\PublishedFilter:
tags: ['api_platform.filter']
Expand Down
29 changes: 29 additions & 0 deletions migrations/Version20240506084815.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Add fields for tracking client status.
*/
final class Version20240506084815 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE screen_user ADD release_timestamp INT DEFAULT NULL, ADD release_version VARCHAR(255) DEFAULT NULL, ADD latest_request DATETIME DEFAULT NULL, ADD client_meta JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
}

public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE screen_user DROP release_timestamp, DROP release_version, DROP latest_request, DROP client_meta');
}
}
124 changes: 124 additions & 0 deletions public/api-spec-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3854,6 +3854,76 @@
"explode": false,
"allowReserved": false
},
{
"name": "exists[screenUser]",
"in": "query",
"description": "",
"required": false,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "boolean"
},
"style": "form",
"explode": false,
"allowReserved": false
},
{
"name": "screenUser.latestRequest[before]",
"in": "query",
"description": "",
"required": false,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "string"
},
"style": "form",
"explode": false,
"allowReserved": false
},
{
"name": "screenUser.latestRequest[strictly_before]",
"in": "query",
"description": "",
"required": false,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "string"
},
"style": "form",
"explode": false,
"allowReserved": false
},
{
"name": "screenUser.latestRequest[after]",
"in": "query",
"description": "",
"required": false,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "string"
},
"style": "form",
"explode": false,
"allowReserved": false
},
{
"name": "screenUser.latestRequest[strictly_after]",
"in": "query",
"description": "",
"required": false,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "string"
},
"style": "form",
"explode": false,
"allowReserved": false
},
{
"name": "createdBy",
"in": "query",
Expand Down Expand Up @@ -11328,6 +11398,15 @@
"null"
]
},
"status": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"modifiedBy": {
"type": "string"
},
Expand Down Expand Up @@ -11403,6 +11482,15 @@
"null"
]
},
"status": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"relationsChecksum": {
"type": "object"
}
Expand Down Expand Up @@ -11470,6 +11558,15 @@
"null"
]
},
"status": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"modifiedBy": {
"type": "string"
},
Expand Down Expand Up @@ -11580,6 +11677,15 @@
"null"
]
},
"status": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"modifiedBy": {
"type": "string"
},
Expand Down Expand Up @@ -11794,6 +11900,15 @@
"null"
]
},
"status": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"modifiedBy": {
"type": "string"
},
Expand Down Expand Up @@ -11904,6 +12019,15 @@
"null"
]
},
"status": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"relationsChecksum": {
"type": "object"
}
Expand Down
Loading
Loading