Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"@coderabbitai summary"
@coderabbitai summary

Thanks for contributing to phpList!
122 changes: 0 additions & 122 deletions src/Identity/OpenApi/SwaggerSchemasRequest.php

This file was deleted.

48 changes: 0 additions & 48 deletions src/Identity/OpenApi/SwaggerSchemasResponse.php

This file was deleted.

23 changes: 23 additions & 0 deletions src/Identity/Request/AdminAttributeDefinitionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace PhpList\RestBundle\Identity\Request;

use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Common\Model\AttributeTypeEnum;
use PhpList\Core\Domain\Identity\Model\Dto\AdminAttributeDefinitionDto;
use PhpList\Core\Domain\Subscription\Validator\AttributeTypeValidator;
use PhpList\RestBundle\Common\Request\RequestInterface;
Expand All @@ -12,6 +14,27 @@
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Exception\ValidatorException;

#[OA\Schema(
schema: 'AdminAttributeDefinitionRequest',
required: ['name'],
properties: [
new OA\Property(property: 'name', type: 'string', format: 'string', example: 'Country'),
new OA\Property(
property: 'type',
type: 'string',
enum: [
AttributeTypeEnum::TextLine,
AttributeTypeEnum::Hidden,
],
example: 'hidden',
nullable: true
),
new OA\Property(property: 'order', type: 'number', example: 12),
new OA\Property(property: 'default_value', type: 'string', example: 'United States'),
new OA\Property(property: 'required', type: 'boolean', example: true),
],
type: 'object'
)]
#[Assert\Callback('validateType')]
class AdminAttributeDefinitionRequest implements RequestInterface
{
Expand Down
46 changes: 46 additions & 0 deletions src/Identity/Request/CreateAdministratorRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,59 @@

namespace PhpList\RestBundle\Identity\Request;

use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Identity\Model\Administrator;
use PhpList\Core\Domain\Identity\Model\Dto\CreateAdministratorDto;
use PhpList\RestBundle\Common\Request\RequestInterface;
use PhpList\RestBundle\Identity\Validator\Constraint\UniqueEmail;
use PhpList\RestBundle\Identity\Validator\Constraint\UniqueLoginName;
use Symfony\Component\Validator\Constraints as Assert;

#[OA\Schema(
schema: 'CreateAdministratorRequest',
required: ['login_name', 'password', 'email', 'super_user'],
properties: [
new OA\Property(
property: 'login_name',
type: 'string',
maxLength: 255,
minLength: 3,
example: 'admin'
),
new OA\Property(
property: 'password',
type: 'string',
format: 'password',
maxLength: 255,
minLength: 6,
example: 'StrongP@ssw0rd'
),
new OA\Property(
property: 'email',
type: 'string',
format: 'email',
example: 'admin@example.com'
),
new OA\Property(
property: 'super_user',
type: 'boolean',
example: false
),
new OA\Property(
property: 'privileges',
description: 'Array of privileges where keys are privilege names and values are booleans',
properties: [
new OA\Property(property: 'subscribers', type: 'boolean', example: true),
new OA\Property(property: 'campaigns', type: 'boolean', example: false),
new OA\Property(property: 'statistics', type: 'boolean', example: true),
new OA\Property(property: 'settings', type: 'boolean', example: false),
],
type: 'object',
example: ['subscribers' => true, 'campaigns' => false, 'statistics' => true, 'settings' => false]
),
],
type: 'object'
)]
class CreateAdministratorRequest implements RequestInterface
{
#[Assert\NotBlank]
Expand Down
46 changes: 45 additions & 1 deletion src/Identity/Request/UpdateAdministratorRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,58 @@

namespace PhpList\RestBundle\Identity\Request;

use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Identity\Model\Administrator;
use PhpList\Core\Domain\Identity\Model\Dto\UpdateAdministratorDto;
use PhpList\Core\Domain\Identity\Model\PrivilegeFlag;
use PhpList\RestBundle\Common\Request\RequestInterface;
use PhpList\RestBundle\Identity\Validator\Constraint\UniqueEmail;
use PhpList\RestBundle\Identity\Validator\Constraint\UniqueLoginName;
use Symfony\Component\Validator\Constraints as Assert;

#[OA\Schema(
schema: 'UpdateAdministratorRequest',
properties: [
new OA\Property(
property: 'login_name',
type: 'string',
maxLength: 255,
minLength: 3,
example: 'admin'
),
new OA\Property(
property: 'password',
type: 'string',
format: 'password',
maxLength: 255,
minLength: 6,
example: 'StrongP@ssw0rd'
),
new OA\Property(
property: 'email',
type: 'string',
format: 'email',
example: 'admin@example.com'
),
new OA\Property(
property: 'super_user',
type: 'boolean',
example: false
),
new OA\Property(
property: 'privileges',
description: 'Array of privileges where keys are privilege names and values are booleans',
properties: [
new OA\Property(property: 'subscribers', type: 'boolean', example: true),
new OA\Property(property: 'campaigns', type: 'boolean', example: false),
new OA\Property(property: 'statistics', type: 'boolean', example: true),
new OA\Property(property: 'settings', type: 'boolean', example: false),
],
type: 'object',
example: ['subscribers' => true, 'campaigns' => false, 'statistics' => true, 'settings' => false]
),
],
type: 'object'
)]
class UpdateAdministratorRequest implements RequestInterface
{
public int $administratorId;
Expand Down
13 changes: 13 additions & 0 deletions src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@

namespace PhpList\RestBundle\Identity\Serializer;

use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Identity\Model\AdminAttributeDefinition;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

#[OA\Schema(
schema: 'AdminAttributeDefinition',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'name', type: 'string', example: 'Country'),
new OA\Property(property: 'type', type: 'string', example: 'hidden'),
new OA\Property(property: 'list_order', type: 'integer', example: 12),
new OA\Property(property: 'default_value', type: 'string', example: 'United States'),
new OA\Property(property: 'required', type: 'boolean', example: true),
],
type: 'object'
)]
class AdminAttributeDefinitionNormalizer implements NormalizerInterface
{
/**
Expand Down
10 changes: 10 additions & 0 deletions src/Identity/Serializer/AdminAttributeValueNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@

namespace PhpList\RestBundle\Identity\Serializer;

use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Identity\Model\AdminAttributeValue;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

#[OA\Schema(
schema: 'AdminAttributeValue',
properties: [
new OA\Property(property: 'administrator', ref: '#/components/schemas/Administrator'),
new OA\Property(property: 'definition', ref: '#/components/schemas/AttributeDefinition'),
new OA\Property(property: 'value', type: 'string', example: 'United States'),
],
type: 'object'
)]
class AdminAttributeValueNormalizer implements NormalizerInterface
{
public function __construct(
Expand Down
Loading
Loading