Skip to content
Open

Dev #169

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
784bb28
Fix: swagger response
tatevikg1 Apr 30, 2026
addb913
Add workflow for updating OpenAPI specs in web frontend and limit cli…
tatevikg1 May 18, 2026
a928154
Add endpoint to retrieve all subscribe pages
tatevikg1 May 20, 2026
112abce
Developer
tatevikg1 May 23, 2026
f03fe55
Add support for subscribe page data management and validation
tatevikg1 May 25, 2026
4a4ddfd
Add public page to return list data
tatevikg1 May 26, 2026
c3bde58
After review 0
tatevikg1 May 27, 2026
6454dea
Normalize attributes key in SubscribePageData
tatevikg1 May 27, 2026
66ecaa9
persist-credentials
tatevikg1 May 29, 2026
3b95468
Add: getPublicPage endpoint
tatevikg1 Jun 1, 2026
2b966c2
Enhance SubscribePagePublicNormalizer to resolve attribute IDs using …
tatevikg1 Jun 2, 2026
3a57f7b
Add PublicSubscriptionRequest class and update subscribe method in Su…
tatevikg1 Jun 3, 2026
cde97d5
Add PublicSubscriptionRequest class and update subscribe method in Su…
tatevikg1 Jun 3, 2026
e7404f4
Add tests
tatevikg1 Jun 4, 2026
fec65e4
Add unsubscribe endpoint
tatevikg1 Jun 4, 2026
1bd7755
Add PublicUnsubscriptionRequest class for unsubscribe functionality i…
tatevikg1 Jun 10, 2026
edb22e4
Feat: ConfigController
tatevikg1 Jun 16, 2026
388965e
Feat: ConfigController tests
tatevikg1 Jun 16, 2026
2ceb34c
Fix: Unique Validators by adding UpdatingId to requests
tatevikg1 Jun 18, 2026
442c7a3
Do not check privileges for dashboard analytics
tatevikg1 Jun 26, 2026
3fa9ecd
Fix: AccessDeniedHttpException code
tatevikg1 Jul 13, 2026
07e5f23
EditorUploadController
tatevikg1 Jul 13, 2026
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
5 changes: 4 additions & 1 deletion .github/workflows/client-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ name: Update phplist-api-client OpenAPI
on:
push:
branches:
- '**'
- dev
- main
pull_request:
branches:
- main

jobs:
generate-openapi:
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/front-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Update phplist-web-frontend OpenAPI

permissions:
contents: write # Required to push to web-frontend repo
actions: read # Required to download artifacts

on:
push:
branches:
- dev
- main
pull_request:
branches:
- main
jobs:
Comment thread
coderabbitai[bot] marked this conversation as resolved.
generate-openapi:
runs-on: ubuntu-22.04
outputs:
source_branch: ${{ steps.branch.outputs.source_branch }}
steps:
- name: Determine source branch
env:
EVENT_NAME: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
REF_NAME: ${{ github.ref_name }}
id: branch
run: |
if [ "$EVENT_NAME" = "pull_request" ]; then
echo "source_branch=$HEAD_REF" >> "$GITHUB_OUTPUT"
else
echo "source_branch=$REF_NAME" >> "$GITHUB_OUTPUT"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Checkout Source Repository
uses: actions/checkout@v4

Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Setup PHP with Composer and Extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: mbstring, dom, fileinfo, mysql

- name: Cache Composer Dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install Composer Dependencies
run: composer install --no-interaction --prefer-dist

- name: Generate OpenAPI Specification JSON
run: vendor/bin/openapi -o docs/latest-restapi.json --format json src

- name: Upload OpenAPI Artifact
uses: actions/upload-artifact@v4
with:
name: openapi-json
path: docs/latest-restapi.json

update-web-frontend:
runs-on: ubuntu-22.04
needs: generate-openapi
env:
TARGET_BRANCH: ${{ needs.generate-openapi.outputs.source_branch }}
steps:
- name: Checkout phpList-web-frontend Repository
uses: actions/checkout@v3
with:
repository: phpList/web-frontend
token: ${{ secrets.PUSH_WEB_FRONTEND }}
fetch-depth: 0

- name: Prepare target branch
run: |
git fetch origin

if git ls-remote --exit-code --heads origin "$TARGET_BRANCH" >/dev/null 2>&1; then
git checkout "$TARGET_BRANCH"
git pull --rebase origin "$TARGET_BRANCH"
else
git checkout -b "$TARGET_BRANCH"
fi

- name: Download Generated OpenAPI JSON
uses: actions/download-artifact@v4
with:
name: openapi-json
path: ./new-openapi

- name: Compare and Check for Differences
id: diff
run: |
# Compare the openapi files if old exists, else always deploy
if [ -f openapi.json ]; then
diff openapi.json new-openapi/latest-restapi.json > openapi-diff.txt || true
if [ -s openapi-diff.txt ]; then
echo "diff=true" >> "$GITHUB_OUTPUT"
else
echo "diff=false" >> "$GITHUB_OUTPUT"
fi
else
echo "No previous openapi.json, will add."
echo "diff=true" >> "$GITHUB_OUTPUT"
fi

- name: Update and Commit OpenAPI File
if: steps.diff.outputs.diff == 'true'
run: |
set -euo pipefail
cp new-openapi/latest-restapi.json openapi.json
git config user.name "github-actions"
git config user.email "github-actions@web-frontend.workflow"
git add openapi.json
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "Update openapi.json from web frontend workflow $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
git fetch origin "$TARGET_BRANCH"
git rebase "origin/$TARGET_BRANCH"
git push origin HEAD:"$TARGET_BRANCH"

- name: Skip Commit if No Changes
if: steps.diff.outputs.diff == 'false'
run: echo "No changes to openapi.json, skipping commit."
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"require": {
"php": "^8.1",
"phplist/core": "dev-main",
"phplist/core": "dev-dev",
Comment thread
TatevikGr marked this conversation as resolved.
"friendsofsymfony/rest-bundle": "*",
"symfony/test-pack": "^1.0",
"symfony/process": "^6.4",
Expand Down Expand Up @@ -126,6 +126,11 @@
"type": "attribute",
"prefix": "/api/v2"
},
"rest-api-configuration": {
"resource": "@PhpListRestBundle/Configuration/Controller/",
"type": "attribute",
"prefix": "/api/v2"
},
"rest-api-analitics": {
"resource": "@PhpListRestBundle/Statistics/Controller/",
"type": "attribute",
Expand Down
7 changes: 7 additions & 0 deletions config/services/controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ services:
autoconfigure: true
public: true

PhpList\RestBundle\Configuration\Controller\:
resource: '../src/Configuration/Controller'
tags: [ 'controller.service_arguments' ]
autowire: true
autoconfigure: true
public: true

PhpList\RestBundle\Statistics\Controller\:
resource: '../src/Statistics/Controller'
tags: [ 'controller.service_arguments' ]
Expand Down
4 changes: 4 additions & 0 deletions config/services/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ services:
autowire: true
autoconfigure: true

PhpList\RestBundle\Subscription\Service\PublicSubscriptionAttributeRuleProvider:
autowire: true
autoconfigure: true

PhpList\Core\Domain\Messaging\Service\ForwardingGuard:
autowire: true
autoconfigure: true
Expand Down
15 changes: 15 additions & 0 deletions config/services/validators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,26 @@ services:
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Configuration\Validator\Constraint\UniqueConfigKeyValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Subscription\Validator\Constraint\ListExistsValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Subscription\Validator\Constraint\ListExistsPublicValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\RestBundle\Subscription\Validator\Constraint\ValidPublicSubscriptionValidator:
autowire: true
autoconfigure: true
tags: [ 'validator.constraint_validator' ]

PhpList\Core\Domain\Identity\Validator\AttributeTypeValidator:
autowire: true
autoconfigure: true
Expand Down
14 changes: 13 additions & 1 deletion src/Common/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
use PhpList\Core\Domain\Messaging\Exception\SubscriberNotFoundException;
use PhpList\Core\Domain\Subscription\Exception\AttributeDefinitionCreationException;
use PhpList\Core\Domain\Subscription\Exception\SubscriptionCreationException;
use PhpList\Core\Domain\Common\Upload\Exception\InvalidUploadException;
use PhpList\Core\Domain\Common\Upload\Exception\MissingUploadException;
use PhpList\Core\Domain\Common\Upload\Exception\StorageException;
use PhpList\Core\Domain\Common\Upload\Exception\UnsupportedExtensionException;
use PhpList\Core\Domain\Common\Upload\Exception\UnsupportedMimeTypeException;
use PhpList\Core\Domain\Common\Upload\Exception\UploadTooLargeException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
Expand All @@ -27,10 +33,16 @@ class ExceptionListener
AttributeDefinitionCreationException::class => null,
AdminAttributeCreationException::class => null,
AccessDeniedException::class => 403,
AccessDeniedHttpException::class => 403,
AccessDeniedHttpException::class => 401,
AttachmentFileNotFoundException::class => 404,
SubscriberNotFoundException::class => 404,
MessageNotReceivedException::class => 422,
MissingUploadException::class => 400,
InvalidUploadException::class => 400,
UnsupportedExtensionException::class => 400,
UnsupportedMimeTypeException::class => 415,
UploadTooLargeException::class => 413,
StorageException::class => 500,
];

public function onKernelException(ExceptionEvent $event): void
Expand Down
9 changes: 5 additions & 4 deletions src/Common/Validator/RequestValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
) {
}

public function validate(Request $request, string $dtoClass): RequestInterface
public function validate(Request $request, string $dtoClass, ?callable $beforeValidation = null): RequestInterface
{
try {
$content = $request->getContent();
Expand All @@ -33,9 +33,6 @@ public function validate(Request $request, string $dtoClass): RequestInterface
if (isset($routeParams['listId'])) {
$routeParams['listId'] = (int) $routeParams['listId'];
}
if (isset($routeParams['templateId'])) {
$routeParams['templateId'] = (int) $routeParams['templateId'];
}

$data = array_merge($routeParams, $request->query->all(), $body ?? []);

Expand All @@ -53,6 +50,10 @@ public function validate(Request $request, string $dtoClass): RequestInterface
);
}

if ($beforeValidation !== null) {
$beforeValidation($dto);
}

return $this->validateDto($dto);
}

Expand Down
Loading
Loading