From 1a8e4fe81199224b910b4e651040c96f5df2747a Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 3 Dec 2024 16:35:04 +0100 Subject: [PATCH 1/7] chore: Updated deps --- composer.json | 6 +++--- docker/php/fpm.d/www.dev.conf | 8 ++++++-- lib/Documents/composer.json | 4 ++-- lib/Markdown/composer.json | 2 +- lib/RoadizCoreBundle/composer.json | 4 ++-- lib/RoadizFontBundle/composer.json | 4 ++-- lib/Rozier/composer.json | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 2e0fa246..fb7d5176 100644 --- a/composer.json +++ b/composer.json @@ -127,11 +127,11 @@ "symfony/web-link": "6.4.*", "symfony/workflow": "6.4.*", "symfony/yaml": "6.4.*", - "twig/extra-bundle": "^3.0", - "twig/html-extra": "^3.3", + "twig/extra-bundle": "^3.16", + "twig/html-extra": "^3.16", "twig/intl-extra": "*", "twig/string-extra": "*", - "twig/twig": "^3.1", + "twig/twig": "^3.16", "webonyx/graphql-php": "^15.11" }, "require-dev": { diff --git a/docker/php/fpm.d/www.dev.conf b/docker/php/fpm.d/www.dev.conf index eebc5300..c87f1370 100644 --- a/docker/php/fpm.d/www.dev.conf +++ b/docker/php/fpm.d/www.dev.conf @@ -3,8 +3,12 @@ user = group = -pm = static -pm.max_children = 10 +; https://spot13.com/pmcalculator/ +pm.max_children = 25 +pm.start_servers = 6 +pm.min_spare_servers = 6 +pm.max_spare_servers = 18 +pm.max_requests = 1000 pm.status_path = /status pm.status_listen = 127.0.0.1:9001 diff --git a/lib/Documents/composer.json b/lib/Documents/composer.json index bfae3088..d26748f3 100644 --- a/lib/Documents/composer.json +++ b/lib/Documents/composer.json @@ -39,10 +39,10 @@ "symfony/http-client-contracts": "^3.5", "symfony/options-resolver": "6.4.*", "symfony/serializer": "6.4.*", - "twig/twig": "^3.1" + "twig/twig": "^3.16" }, "require-dev": { - "api-platform/metadata": "^3.2.12", + "api-platform/metadata": "~3.3.11", "doctrine/doctrine-bundle": "^2.8.1", "php-coveralls/php-coveralls": "^2.4", "phpstan/phpstan": "^1.5.3", diff --git a/lib/Markdown/composer.json b/lib/Markdown/composer.json index fade4ff4..64f83ff6 100644 --- a/lib/Markdown/composer.json +++ b/lib/Markdown/composer.json @@ -7,7 +7,7 @@ "doctrine/collections": ">=1.6", "league/commonmark": "^2.2.0", "symfony/stopwatch": "6.4.*", - "twig/twig": "^3.1" + "twig/twig": "^3.16" }, "require-dev": { "phpstan/phpstan": "^1.5.3" diff --git a/lib/RoadizCoreBundle/composer.json b/lib/RoadizCoreBundle/composer.json index 6774986b..40383896 100644 --- a/lib/RoadizCoreBundle/composer.json +++ b/lib/RoadizCoreBundle/composer.json @@ -89,10 +89,10 @@ "symfony/web-link": "6.4.*", "symfony/workflow": "6.4.*", "symfony/yaml": "6.4.*", - "twig/extra-bundle": "^3.0", + "twig/extra-bundle": "^3.16", "twig/intl-extra": "*", "twig/string-extra": "*", - "twig/twig": "^3.1" + "twig/twig": "^3.16" }, "replace": { "roadiz/roadiz": "*" diff --git a/lib/RoadizFontBundle/composer.json b/lib/RoadizFontBundle/composer.json index 8d850e7b..3f87ac08 100644 --- a/lib/RoadizFontBundle/composer.json +++ b/lib/RoadizFontBundle/composer.json @@ -43,10 +43,10 @@ "symfony/twig-bundle": "6.4.*", "symfony/validator": "6.4.*", "symfony/yaml": "6.4.*", - "twig/extra-bundle": "^3.0", + "twig/extra-bundle": "^3.16", "twig/intl-extra": "*", "twig/string-extra": "*", - "twig/twig": "^3.1" + "twig/twig": "^3.16" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4", diff --git a/lib/Rozier/composer.json b/lib/Rozier/composer.json index f6820606..ca03bfa7 100644 --- a/lib/Rozier/composer.json +++ b/lib/Rozier/composer.json @@ -61,7 +61,7 @@ "symfony/validator": "6.4.*", "symfony/workflow": "6.4.*", "symfony/yaml": "6.4.*", - "twig/twig": "^3.1" + "twig/twig": "^3.16" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4", From d6c2600ac42940617b2665bd6accbb9cd097dbdb Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 3 Dec 2024 17:21:26 +0100 Subject: [PATCH 2/7] chore: Fix PurgeReverseProxyCacheMessageHandler to search for all NodesSources --- .../src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php b/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php index 33013681..c884f3cc 100644 --- a/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php +++ b/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php @@ -34,6 +34,7 @@ public function __invoke(PurgeReverseProxyCacheMessage $message): void { $nodeSource = $this->managerRegistry ->getRepository(NodesSources::class) + ->setDisplayingAllNodesStatuses(true) ->find($message->getNodeSourceId()); if (null === $nodeSource) { throw new UnrecoverableMessageHandlingException('NodesSources does not exist anymore.'); From fd738671ec85a6c31f25ba5a7b5a84a200eae720 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 3 Dec 2024 23:15:36 +0100 Subject: [PATCH 3/7] chore: Disable node-type delete form on prod --- .../NodeTypes/NodeTypesController.php | 21 ++++++++++--------- .../src/Resources/translations/messages.xlf | 1 + .../views/node-types/delete.html.twig | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/Rozier/src/Controllers/NodeTypes/NodeTypesController.php b/lib/Rozier/src/Controllers/NodeTypes/NodeTypesController.php index 1f5f68ef..4e9b62ea 100644 --- a/lib/Rozier/src/Controllers/NodeTypes/NodeTypesController.php +++ b/lib/Rozier/src/Controllers/NodeTypes/NodeTypesController.php @@ -148,24 +148,25 @@ public function deleteAction(Request $request, int $nodeTypeId): Response throw $this->createNotFoundException(); } - $form = $this->createForm(FormType::class); + $form = $this->createForm(FormType::class, options: [ + 'disabled' => !$this->allowNodeTypeEdition, + ]); $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { - if (!$this->allowNodeTypeEdition) { - $form->addError(new FormError('You cannot delete a node-type in production mode.')); - } else { - $this->messageBus->dispatch(new Envelope(new DeleteNodeTypeMessage($nodeType->getId()))); + if (!$this->allowNodeTypeEdition) { + $form->addError(new FormError('You cannot delete a node-type in production mode.')); + } elseif ($form->isSubmitted() && $form->isValid()) { + $this->messageBus->dispatch(new Envelope(new DeleteNodeTypeMessage($nodeType->getId()))); - $msg = $this->getTranslator()->trans('nodeType.%name%.deleted', ['%name%' => $nodeType->getName()]); - $this->publishConfirmMessage($request, $msg, $nodeType); + $msg = $this->getTranslator()->trans('nodeType.%name%.deleted', ['%name%' => $nodeType->getName()]); + $this->publishConfirmMessage($request, $msg, $nodeType); - return $this->redirectToRoute('nodeTypesHomePage'); - } + return $this->redirectToRoute('nodeTypesHomePage'); } $this->assignation['form'] = $form->createView(); $this->assignation['nodeType'] = $nodeType; + $this->assignation['disabled'] = !$this->allowNodeTypeEdition; return $this->render('@RoadizRozier/node-types/delete.html.twig', $this->assignation); } diff --git a/lib/Rozier/src/Resources/translations/messages.xlf b/lib/Rozier/src/Resources/translations/messages.xlf index 0914a9cd..6d3fae26 100644 --- a/lib/Rozier/src/Resources/translations/messages.xlf +++ b/lib/Rozier/src/Resources/translations/messages.xlf @@ -1198,6 +1198,7 @@ document.is_only_externalWarning message displayed when document does not have any file locally. reachableFor node-types, defines if produced nodes will be reachable with an URL or not (eg. just content blocks). + You cannot delete a node-type in production mode.For node-types, a notice when env is prod to prevent editing node-type schema in production. yaml.type manage.redirectionsRedirection section button label diff --git a/lib/Rozier/src/Resources/views/node-types/delete.html.twig b/lib/Rozier/src/Resources/views/node-types/delete.html.twig index e3986302..01b48e3f 100644 --- a/lib/Rozier/src/Resources/views/node-types/delete.html.twig +++ b/lib/Rozier/src/Resources/views/node-types/delete.html.twig @@ -17,7 +17,7 @@
{% trans %}are_you_sure.delete.nodeType.and.nodes.newsletters{% endtrans %} {% trans %}cancel{% endtrans %} - +
{{ form_end(form) }} From 3e8819a27149f1db7fe18fb7c4306513ae994af2 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 3 Dec 2024 23:48:12 +0100 Subject: [PATCH 4/7] chore: Removed dead methods and deprecations --- lib/RoadizCoreBundle/src/Entity/Node.php | 28 ------ .../src/EntityHandler/NodeHandler.php | 92 ------------------- .../src/EntityHandler/NodesSourcesHandler.php | 51 ---------- .../NodeRedirectionSubscriber.php | 8 +- lib/RoadizCoreBundle/src/Node/NodeFactory.php | 6 +- .../src/Node/UniversalDataDuplicator.php | 4 +- .../src/Repository/PrefixAwareRepository.php | 1 - 7 files changed, 9 insertions(+), 181 deletions(-) diff --git a/lib/RoadizCoreBundle/src/Entity/Node.php b/lib/RoadizCoreBundle/src/Entity/Node.php index 23a90607..1bf1cd74 100644 --- a/lib/RoadizCoreBundle/src/Entity/Node.php +++ b/lib/RoadizCoreBundle/src/Entity/Node.php @@ -824,13 +824,6 @@ public function getANodes(): Collection return $this->aNodes; } - #[SymfonySerializer\Ignore] - public function getOneLineSummary(): string - { - return $this->getId().' — '.$this->getNodeName().' — '.$this->getNodeType()->getName(). - ' — Visible : '.($this->isVisible() ? 'true' : 'false').PHP_EOL; - } - public function getNodeName(): string { return $this->nodeName; @@ -873,27 +866,6 @@ public function setVisible(bool $visible): Node return $this; } - #[SymfonySerializer\Ignore] - public function getOneLineSourceSummary(): string - { - $text = 'Source '. - ( - $this->getNodeSources()->first() ? - $this->getNodeSources()->first()->getId() : - '' - ). - PHP_EOL; - - foreach ($this->getNodeType()->getFields() as $field) { - $getterName = $field->getGetterName(); - $text .= '['.$field->getLabel().']: '. - ($this->getNodeSources()->first() ? $this->getNodeSources()->first()->$getterName() : ''). - PHP_EOL; - } - - return $text; - } - /** * After clone method. * diff --git a/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php b/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php index 9cb0fd8c..7a3deb1b 100644 --- a/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php +++ b/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php @@ -15,7 +15,6 @@ use RZ\Roadiz\CoreBundle\Entity\NodesSources; use RZ\Roadiz\CoreBundle\Entity\NodesToNodes; use RZ\Roadiz\CoreBundle\Entity\NodeTypeField; -use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\Node\NodeDuplicator; use RZ\Roadiz\CoreBundle\Node\NodeNamePolicyInterface; use RZ\Roadiz\CoreBundle\Repository\NodeRepository; @@ -189,66 +188,6 @@ public function addNodeForField(Node $node, NodeTypeFieldInterface $field, bool return $this; } - /** - * Get nodes linked to current node for a given field name. - * - * @param string $fieldName Name of the node-type field - * - * @return Node[] - * - * @deprecated - */ - public function getNodesFromFieldName(string $fieldName): array - { - $field = $this->getNode()->getNodeType()->getFieldByName($fieldName); - if (null !== $field) { - return $this->getRepository() - ->findByNodeAndField( - $this->getNode(), - $field - ); - } - - return []; - } - - /** - * Get nodes reversed-linked to current node for a given field name. - * - * @param string $fieldName Name of the node-type field - * - * @return Node[] - * - * @deprecated - */ - public function getReverseNodesFromFieldName(string $fieldName): array - { - $field = $this->getNode()->getNodeType()->getFieldByName($fieldName); - if (null !== $field) { - return $this->getRepository() - ->findByReverseNodeAndField( - $this->getNode(), - $field - ); - } - - return []; - } - - /** - * Get node source by translation. - * - * @param Translation $translation - * - * @deprecated use Node::getNodeSourcesByTranslation() instead - */ - public function getNodeSourceByTranslation($translation): ?NodesSources - { - return $this->objectManager - ->getRepository(NodesSources::class) - ->findOneBy(['node' => $this->getNode(), 'translation' => $translation]); - } - /** * Remove only current node children. * @@ -519,37 +458,6 @@ public function cleanRootNodesPositions(bool $setPositions = true): float return $i; } - /** - * Return all node offspring id. - * - * @deprecated use NodeOffspringResolverInterface::getAllOffspringIds($chroot) - */ - public function getAllOffspringId(): array - { - return $this->getRepository()->findAllOffspringIdByNode($this->getNode()); - } - - /** - * Set current node as the Home node. - * - * @return $this - */ - public function makeHome(): self - { - $defaults = $this->getRepository() - ->setDisplayingNotPublishedNodes(true) - ->findBy(['home' => true]); - - /** @var Node $default */ - foreach ($defaults as $default) { - $default->setHome(false); - } - $this->getNode()->setHome(true); - $this->objectManager->flush(); - - return $this; - } - /** * Duplicate current node with all its children. * diff --git a/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php b/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php index 1b4f8a8c..23467a2f 100644 --- a/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php +++ b/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php @@ -10,7 +10,6 @@ use RZ\Roadiz\Core\Handlers\AbstractHandler; use RZ\Roadiz\CoreBundle\Bag\Settings; use RZ\Roadiz\CoreBundle\Entity\Document; -use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodesSources; use RZ\Roadiz\CoreBundle\Entity\NodesSourcesDocuments; use RZ\Roadiz\CoreBundle\Entity\NodeTypeField; @@ -468,54 +467,4 @@ public function getSEO(): array $this->nodeSource->getTitle().', '.$this->settingsBag->get('seo_description'), ]; } - - /** - * Get nodes linked to current node for a given fieldname. - * - * @param string $fieldName Name of the node-type field - * - * @return array Collection of nodes - * - * @deprecated - */ - public function getNodesFromFieldName(string $fieldName): array - { - $field = $this->nodeSource->getNode()->getNodeType()->getFieldByName($fieldName); - if (null !== $field) { - return $this->objectManager - ->getRepository(Node::class) - ->findByNodeAndFieldAndTranslation( - $this->nodeSource->getNode(), - $field, - $this->nodeSource->getTranslation() - ); - } - - return []; - } - - /** - * Get nodes which own a reference to current node for a given fieldname. - * - * @param string $fieldName Name of the node-type field - * - * @return array Collection of nodes - * - * @deprecated - */ - public function getReverseNodesFromFieldName(string $fieldName): array - { - $field = $this->nodeSource->getNode()->getNodeType()->getFieldByName($fieldName); - if (null !== $field) { - return $this->objectManager - ->getRepository(Node::class) - ->findByReverseNodeAndFieldAndTranslation( - $this->nodeSource->getNode(), - $field, - $this->nodeSource->getTranslation() - ); - } - - return []; - } } diff --git a/lib/RoadizCoreBundle/src/EventSubscriber/NodeRedirectionSubscriber.php b/lib/RoadizCoreBundle/src/EventSubscriber/NodeRedirectionSubscriber.php index 7579b523..68740229 100644 --- a/lib/RoadizCoreBundle/src/EventSubscriber/NodeRedirectionSubscriber.php +++ b/lib/RoadizCoreBundle/src/EventSubscriber/NodeRedirectionSubscriber.php @@ -14,12 +14,12 @@ /** * Subscribe to Node, NodesSources and UrlAlias event to clear ns url cache. */ -class NodeRedirectionSubscriber implements EventSubscriberInterface +readonly class NodeRedirectionSubscriber implements EventSubscriberInterface { public function __construct( - protected readonly NodeMover $nodeMover, - protected readonly string $kernelEnvironment, - protected readonly PreviewResolverInterface $previewResolver, + protected NodeMover $nodeMover, + protected string $kernelEnvironment, + protected PreviewResolverInterface $previewResolver, ) { } diff --git a/lib/RoadizCoreBundle/src/Node/NodeFactory.php b/lib/RoadizCoreBundle/src/Node/NodeFactory.php index f38a4d16..dce62a6d 100644 --- a/lib/RoadizCoreBundle/src/Node/NodeFactory.php +++ b/lib/RoadizCoreBundle/src/Node/NodeFactory.php @@ -15,11 +15,11 @@ use RZ\Roadiz\CoreBundle\Repository\NodeRepository; use RZ\Roadiz\CoreBundle\Repository\UrlAliasRepository; -final class NodeFactory +final readonly class NodeFactory { public function __construct( - private readonly ManagerRegistry $managerRegistry, - private readonly NodeNamePolicyInterface $nodeNamePolicy, + private ManagerRegistry $managerRegistry, + private NodeNamePolicyInterface $nodeNamePolicy, ) { } diff --git a/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php b/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php index 51fc176b..b9f16216 100644 --- a/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php +++ b/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php @@ -14,9 +14,9 @@ use RZ\Roadiz\CoreBundle\Repository\NodesSourcesRepository; use RZ\Roadiz\CoreBundle\Repository\TranslationRepository; -final class UniversalDataDuplicator +final readonly class UniversalDataDuplicator { - public function __construct(private readonly ManagerRegistry $managerRegistry) + public function __construct(private ManagerRegistry $managerRegistry) { } diff --git a/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php b/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php index e666ee50..fcde69c9 100644 --- a/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php +++ b/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php @@ -4,7 +4,6 @@ namespace RZ\Roadiz\CoreBundle\Repository; -use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\Tools\Pagination\Paginator; use RZ\Roadiz\CoreBundle\Doctrine\ORM\SimpleQueryBuilder; From 65922978aa6b158627df4e262b65c38a3fce9914 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Wed, 4 Dec 2024 01:46:25 +0100 Subject: [PATCH 5/7] doc: Updated Bruno --- ...e ressources archives months and years.bru | 90 +++++++++++++++++ .../Retrieves a Article resource-.bru} | 12 ++- ...s the collection of Article resources-.bru | 90 +++++++++++++++++ ...Retrieves a ArticleContainer resource-.bru | 23 +++++ ...lection of ArticleContainer resources-.bru | 85 ++++++++++++++++ ...Retrieves a ArticleFeedBlock resource-.bru | 23 +++++ .../Retrieves a AttributeValue resource-.bru | 23 +++++ ...ollection of AttributeValue resources-.bru | 57 +++++++++++ .../Retrieves a BasicBlock resource-.bru | 23 +++++ .../Retrieves a CommonContent resource-.bru | 19 ++++ ... a custom form definition for frontend.bru | 23 +++++ .../CustomForm/Post a user custom form.bru | 17 ++++ .../Retrieves a CustomForm resource-.bru | 23 +++++ ...he collection of CustomForm resources-.bru | 22 +++++ .../Retrieves a Document resource-.bru | 12 ++- ... the collection of Document resources-.bru | 53 ++++++++++ .../Retrieves a Folder resource-.bru | 12 ++- ...es the collection of Folder resources-.bru | 39 ++++++++ .../Retrieves a GroupBlock resource-.bru | 23 +++++ .../Creates a user token-.bru} | 8 +- .../Menu/Retrieves a Menu resource-.bru | 23 +++++ .../Retrieves a MenuLink resource-.bru | 23 +++++ .../Neutral/Retrieves a Neutral resource-.bru | 23 +++++ .../Get available NodesSources archives.bru | 85 ++++++++++++++++ .../Retrieves a NodesSources resource-.bru | 12 ++- ... collection of NodesSources resources-.bru | 85 ++++++++++++++++ .../Search NodesSources resources.bru | 86 ++++++++++++++++ .../NsNode/Retrieves a NsNode resource-.bru | 23 +++++ .../Offer/Retrieves a Offer resource-.bru | 23 +++++ ...ves the collection of Offer resources-.bru | 97 +++++++++++++++++++ ...e ressources archives months and years.bru | 97 +++++++++++++++++++ .../Page/Retrieves a Page resource-.bru | 23 +++++ ...eves the collection of Page resources-.bru | 97 +++++++++++++++++++ .../Retrieves a Realm resource-.bru | 14 ++- .../Retrieves a Tag resource-.bru | 12 ++- ...ieves the collection of Tag resources-.bru | 61 ++++++++++++ .../Retrieves a Translation resource-.bru | 12 ++- ...e collection of Translation resources-.bru | 33 +++++++ .../User/Create a new public user.bru | 20 ++++ ...t a public user email validation token.bru | 15 +-- .../Request a public user new password.bru | 11 +-- .../User/Reset a public user password.bru | 16 +++ .../Retrieves a User resource-.bru} | 12 ++- ...eves the collection of User resources-.bru | 21 ++++ .../User/Validate a public user email.bru | 16 +++ .../Get current user -JWT- information.bru | 19 ++++ ... path wrapped in a WebResponse object.bru} | 13 +-- ...s path wrapped in a WebResponse object.bru | 32 ++++++ .../api/articles/Articles archives.bru | 19 ---- .../api/articles/Get article collection.bru | 20 ---- ...lection of Attribute Values resources-.bru | 31 ------ ...Retrieves an Attribute Value resource-.bru | 19 ---- ...lection of Attribute Values resources-.bru | 27 ------ .../api_contact_form_definition.bru | 11 --- .../contact form/api_contact_form_post.bru | 22 ----- .../api/custom forms/Custom form POST.bru | 30 ------ .../custom forms/Custom form definition.bru | 23 ----- ... the collection of Document resources-.bru | 28 ------ ...es the collection of Folder resources-.bru | 22 ----- ...Retrieves the Archives of NodesSources.bru | 78 --------------- ... collection of NodesSources resources-.bru | 79 --------------- .../Search NodesSources resources.bru | 25 ----- ...ves the collection of Realm resources-.bru | 11 --- ...ieves the collection of Tag resources-.bru | 23 ----- ...e collection of Translation resources-.bru | 20 ---- .../api/users/Check a public login-link.bru | 30 ------ .../Create a new public passwordless user.bru | 35 ------- .../api/users/Create a new public user.bru | 36 ------- .../Get current user JWT information.bru | 15 --- .../api/users/Get users collection.bru | 15 --- .../users/Reset a public user password.bru | 18 ---- .../users/Validate a public user email.bru | 21 ---- ...Auth- WebResponse resource by its path.bru | 36 ------- .../web_response/Common content response.bru | 15 --- .../environments/Local Dev - Traefik.bru | 2 +- .../environments/Local Dev.bru | 2 +- .../environments/Local public user.bru | 2 +- 77 files changed, 1622 insertions(+), 774 deletions(-) create mode 100644 bruno/Roadiz development app/Article/Retrieve all Article ressources archives months and years.bru rename bruno/Roadiz development app/{api/articles/Get single article.bru => Article/Retrieves a Article resource-.bru} (52%) create mode 100644 bruno/Roadiz development app/Article/Retrieves the collection of Article resources-.bru create mode 100644 bruno/Roadiz development app/ArticleContainer/Retrieves a ArticleContainer resource-.bru create mode 100644 bruno/Roadiz development app/ArticleContainer/Retrieves the collection of ArticleContainer resources-.bru create mode 100644 bruno/Roadiz development app/ArticleFeedBlock/Retrieves a ArticleFeedBlock resource-.bru create mode 100644 bruno/Roadiz development app/AttributeValue/Retrieves a AttributeValue resource-.bru create mode 100644 bruno/Roadiz development app/AttributeValue/Retrieves the collection of AttributeValue resources-.bru create mode 100644 bruno/Roadiz development app/BasicBlock/Retrieves a BasicBlock resource-.bru create mode 100644 bruno/Roadiz development app/CommonContent/Retrieves a CommonContent resource-.bru create mode 100644 bruno/Roadiz development app/CustomForm/Get a custom form definition for frontend.bru create mode 100644 bruno/Roadiz development app/CustomForm/Post a user custom form.bru create mode 100644 bruno/Roadiz development app/CustomForm/Retrieves a CustomForm resource-.bru create mode 100644 bruno/Roadiz development app/CustomForm/Retrieves the collection of CustomForm resources-.bru rename bruno/Roadiz development app/{api/documents => Document}/Retrieves a Document resource-.bru (63%) create mode 100644 bruno/Roadiz development app/Document/Retrieves the collection of Document resources-.bru rename bruno/Roadiz development app/{api/folders => Folder}/Retrieves a Folder resource-.bru (62%) create mode 100644 bruno/Roadiz development app/Folder/Retrieves the collection of Folder resources-.bru create mode 100644 bruno/Roadiz development app/GroupBlock/Retrieves a GroupBlock resource-.bru rename bruno/Roadiz development app/{api/token.bru => Login Check/Creates a user token-.bru} (70%) create mode 100644 bruno/Roadiz development app/Menu/Retrieves a Menu resource-.bru create mode 100644 bruno/Roadiz development app/MenuLink/Retrieves a MenuLink resource-.bru create mode 100644 bruno/Roadiz development app/Neutral/Retrieves a Neutral resource-.bru create mode 100644 bruno/Roadiz development app/NodesSources/Get available NodesSources archives.bru rename bruno/Roadiz development app/{api/nodes sources => NodesSources}/Retrieves a NodesSources resource-.bru (64%) create mode 100644 bruno/Roadiz development app/NodesSources/Retrieves the collection of NodesSources resources-.bru create mode 100644 bruno/Roadiz development app/NodesSources/Search NodesSources resources.bru create mode 100644 bruno/Roadiz development app/NsNode/Retrieves a NsNode resource-.bru create mode 100644 bruno/Roadiz development app/Offer/Retrieves a Offer resource-.bru create mode 100644 bruno/Roadiz development app/Offer/Retrieves the collection of Offer resources-.bru create mode 100644 bruno/Roadiz development app/Page/Retrieve all Page ressources archives months and years.bru create mode 100644 bruno/Roadiz development app/Page/Retrieves a Page resource-.bru create mode 100644 bruno/Roadiz development app/Page/Retrieves the collection of Page resources-.bru rename bruno/Roadiz development app/{api/realms => Realm}/Retrieves a Realm resource-.bru (56%) rename bruno/Roadiz development app/{api/tags => Tag}/Retrieves a Tag resource-.bru (61%) create mode 100644 bruno/Roadiz development app/Tag/Retrieves the collection of Tag resources-.bru rename bruno/Roadiz development app/{api/translations => Translation}/Retrieves a Translation resource-.bru (64%) create mode 100644 bruno/Roadiz development app/Translation/Retrieves the collection of Translation resources-.bru create mode 100644 bruno/Roadiz development app/User/Create a new public user.bru rename bruno/Roadiz development app/{api/users => User}/Request a public user email validation token.bru (51%) rename bruno/Roadiz development app/{api/users => User}/Request a public user new password.bru (59%) create mode 100644 bruno/Roadiz development app/User/Reset a public user password.bru rename bruno/Roadiz development app/{api/users/Get a single user.bru => User/Retrieves a User resource-.bru} (55%) create mode 100644 bruno/Roadiz development app/User/Retrieves the collection of User resources-.bru create mode 100644 bruno/Roadiz development app/User/Validate a public user email.bru create mode 100644 bruno/Roadiz development app/UserOutput/Get current user -JWT- information.bru rename bruno/Roadiz development app/{api/web_response/Get a WebResponse resource by its path.bru => WebResponse/Get a Page by its path wrapped in a WebResponse object.bru} (74%) create mode 100644 bruno/Roadiz development app/WebResponse/[Auth] Get a Page by its path wrapped in a WebResponse object.bru delete mode 100644 bruno/Roadiz development app/api/articles/Articles archives.bru delete mode 100644 bruno/Roadiz development app/api/articles/Get article collection.bru delete mode 100644 bruno/Roadiz development app/api/attribute values/-Auth- Retrieves the collection of Attribute Values resources-.bru delete mode 100644 bruno/Roadiz development app/api/attribute values/Retrieves an Attribute Value resource-.bru delete mode 100644 bruno/Roadiz development app/api/attribute values/Retrieves the collection of Attribute Values resources-.bru delete mode 100644 bruno/Roadiz development app/api/contact form/api_contact_form_definition.bru delete mode 100644 bruno/Roadiz development app/api/contact form/api_contact_form_post.bru delete mode 100644 bruno/Roadiz development app/api/custom forms/Custom form POST.bru delete mode 100644 bruno/Roadiz development app/api/custom forms/Custom form definition.bru delete mode 100644 bruno/Roadiz development app/api/documents/Retrieves the collection of Document resources-.bru delete mode 100644 bruno/Roadiz development app/api/folders/Retrieves the collection of Folder resources-.bru delete mode 100644 bruno/Roadiz development app/api/nodes sources/Retrieves the Archives of NodesSources.bru delete mode 100644 bruno/Roadiz development app/api/nodes sources/Retrieves the collection of NodesSources resources-.bru delete mode 100644 bruno/Roadiz development app/api/nodes sources/Search NodesSources resources.bru delete mode 100644 bruno/Roadiz development app/api/realms/Retrieves the collection of Realm resources-.bru delete mode 100644 bruno/Roadiz development app/api/tags/Retrieves the collection of Tag resources-.bru delete mode 100644 bruno/Roadiz development app/api/translations/Retrieves the collection of Translation resources-.bru delete mode 100644 bruno/Roadiz development app/api/users/Check a public login-link.bru delete mode 100644 bruno/Roadiz development app/api/users/Create a new public passwordless user.bru delete mode 100644 bruno/Roadiz development app/api/users/Create a new public user.bru delete mode 100644 bruno/Roadiz development app/api/users/Get current user JWT information.bru delete mode 100644 bruno/Roadiz development app/api/users/Get users collection.bru delete mode 100644 bruno/Roadiz development app/api/users/Reset a public user password.bru delete mode 100644 bruno/Roadiz development app/api/users/Validate a public user email.bru delete mode 100644 bruno/Roadiz development app/api/web_response/-Auth- WebResponse resource by its path.bru delete mode 100644 bruno/Roadiz development app/api/web_response/Common content response.bru diff --git a/bruno/Roadiz development app/Article/Retrieve all Article ressources archives months and years.bru b/bruno/Roadiz development app/Article/Retrieve all Article ressources archives months and years.bru new file mode 100644 index 00000000..5d30074a --- /dev/null +++ b/bruno/Roadiz development app/Article/Retrieve all Article ressources archives months and years.bru @@ -0,0 +1,90 @@ +meta { + name: Retrieve all Article ressources archives months and years + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/articles/archives + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[unpublishedAt]: + ~order[publishedAt]: + ~unpublishedAt[before]: + ~unpublishedAt[strictly_before]: + ~unpublishedAt[after]: + ~unpublishedAt[strictly_after]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~title: + ~metaTitle: + ~metaDescription: + ~publishedAt[archive]: + ~noIndex: + ~_locale: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/articles/Get single article.bru b/bruno/Roadiz development app/Article/Retrieves a Article resource-.bru similarity index 52% rename from bruno/Roadiz development app/api/articles/Get single article.bru rename to bruno/Roadiz development app/Article/Retrieves a Article resource-.bru index 113aad69..b4adea5e 100644 --- a/bruno/Roadiz development app/api/articles/Get single article.bru +++ b/bruno/Roadiz development app/Article/Retrieves a Article resource-.bru @@ -1,5 +1,5 @@ meta { - name: Get single article + name: Retrieves a Article resource- type: http seq: 3 } @@ -7,13 +7,17 @@ meta { get { url: {{baseUrl}}/api/articles/:id body: none - auth: none + auth: bearer } params:query { - ~_preview: 1 + ~_preview: } params:path { - id: 1019 + id: +} + +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/Article/Retrieves the collection of Article resources-.bru b/bruno/Roadiz development app/Article/Retrieves the collection of Article resources-.bru new file mode 100644 index 00000000..4bdc2426 --- /dev/null +++ b/bruno/Roadiz development app/Article/Retrieves the collection of Article resources-.bru @@ -0,0 +1,90 @@ +meta { + name: Retrieves the collection of Article resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/articles + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[unpublishedAt]: + ~order[publishedAt]: + ~unpublishedAt[before]: + ~unpublishedAt[strictly_before]: + ~unpublishedAt[after]: + ~unpublishedAt[strictly_after]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~title: + ~metaTitle: + ~metaDescription: + ~publishedAt[archive]: + ~noIndex: + ~_locale: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/ArticleContainer/Retrieves a ArticleContainer resource-.bru b/bruno/Roadiz development app/ArticleContainer/Retrieves a ArticleContainer resource-.bru new file mode 100644 index 00000000..b100b059 --- /dev/null +++ b/bruno/Roadiz development app/ArticleContainer/Retrieves a ArticleContainer resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a ArticleContainer resource- + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/article_containers/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/ArticleContainer/Retrieves the collection of ArticleContainer resources-.bru b/bruno/Roadiz development app/ArticleContainer/Retrieves the collection of ArticleContainer resources-.bru new file mode 100644 index 00000000..4dcb4707 --- /dev/null +++ b/bruno/Roadiz development app/ArticleContainer/Retrieves the collection of ArticleContainer resources-.bru @@ -0,0 +1,85 @@ +meta { + name: Retrieves the collection of ArticleContainer resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/article_containers + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~title: + ~metaTitle: + ~metaDescription: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~order[publishedAt]: + ~publishedAt[archive]: + ~noIndex: + ~_locale: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/ArticleFeedBlock/Retrieves a ArticleFeedBlock resource-.bru b/bruno/Roadiz development app/ArticleFeedBlock/Retrieves a ArticleFeedBlock resource-.bru new file mode 100644 index 00000000..da22db03 --- /dev/null +++ b/bruno/Roadiz development app/ArticleFeedBlock/Retrieves a ArticleFeedBlock resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a ArticleFeedBlock resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/article_feed_blocks/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/AttributeValue/Retrieves a AttributeValue resource-.bru b/bruno/Roadiz development app/AttributeValue/Retrieves a AttributeValue resource-.bru new file mode 100644 index 00000000..c5739c85 --- /dev/null +++ b/bruno/Roadiz development app/AttributeValue/Retrieves a AttributeValue resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a AttributeValue resource- + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/attribute_values/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/AttributeValue/Retrieves the collection of AttributeValue resources-.bru b/bruno/Roadiz development app/AttributeValue/Retrieves the collection of AttributeValue resources-.bru new file mode 100644 index 00000000..cd9d2892 --- /dev/null +++ b/bruno/Roadiz development app/AttributeValue/Retrieves the collection of AttributeValue resources-.bru @@ -0,0 +1,57 @@ +meta { + name: Retrieves the collection of AttributeValue resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/attribute_values + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[position]: + ~order[attribute.weight]: + ~node: + ~node[]: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~attribute.id: + ~attribute.id[]: + ~attribute.code: + ~attribute.code[]: + ~attribute.color: + ~attribute.color[]: + ~attribute.type: + ~attribute.type[]: + ~attribute.group: + ~attribute.group[]: + ~attribute.group.canonicalName: + ~attribute.group.canonicalName[]: + ~attributeValueTranslations.value: + ~node.visible: + ~attribute.searchable: + ~exists[attribute.color]: + ~exists[attribute.group]: + ~exists[attributeValueTranslations.value]: + ~attributeValueTranslations.value[between]: + ~attributeValueTranslations.value[gt]: + ~attributeValueTranslations.value[gte]: + ~attributeValueTranslations.value[lt]: + ~attributeValueTranslations.value[lte]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/BasicBlock/Retrieves a BasicBlock resource-.bru b/bruno/Roadiz development app/BasicBlock/Retrieves a BasicBlock resource-.bru new file mode 100644 index 00000000..a8e8efc7 --- /dev/null +++ b/bruno/Roadiz development app/BasicBlock/Retrieves a BasicBlock resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a BasicBlock resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/basic_blocks/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/CommonContent/Retrieves a CommonContent resource-.bru b/bruno/Roadiz development app/CommonContent/Retrieves a CommonContent resource-.bru new file mode 100644 index 00000000..31cdcddc --- /dev/null +++ b/bruno/Roadiz development app/CommonContent/Retrieves a CommonContent resource-.bru @@ -0,0 +1,19 @@ +meta { + name: Retrieves a CommonContent resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/common_content + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/CustomForm/Get a custom form definition for frontend.bru b/bruno/Roadiz development app/CustomForm/Get a custom form definition for frontend.bru new file mode 100644 index 00000000..c7a4869c --- /dev/null +++ b/bruno/Roadiz development app/CustomForm/Get a custom form definition for frontend.bru @@ -0,0 +1,23 @@ +meta { + name: Get a custom form definition for frontend + type: http + seq: 3 +} + +get { + url: {{baseUrl}}/api/custom_forms/:id/definition + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/CustomForm/Post a user custom form.bru b/bruno/Roadiz development app/CustomForm/Post a user custom form.bru new file mode 100644 index 00000000..e3654f9c --- /dev/null +++ b/bruno/Roadiz development app/CustomForm/Post a user custom form.bru @@ -0,0 +1,17 @@ +meta { + name: Post a user custom form + type: http + seq: 4 +} + +post { + url: {{baseUrl}}/api/custom_forms/:id/post + body: multipartForm + auth: none +} + +body:multipart-form { + custom_form_slug[email]: + custom_form_slug[first_name]: + custom_form_slug[last_name]: +} diff --git a/bruno/Roadiz development app/CustomForm/Retrieves a CustomForm resource-.bru b/bruno/Roadiz development app/CustomForm/Retrieves a CustomForm resource-.bru new file mode 100644 index 00000000..1ed558d0 --- /dev/null +++ b/bruno/Roadiz development app/CustomForm/Retrieves a CustomForm resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a CustomForm resource- + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/custom_forms/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/CustomForm/Retrieves the collection of CustomForm resources-.bru b/bruno/Roadiz development app/CustomForm/Retrieves the collection of CustomForm resources-.bru new file mode 100644 index 00000000..a95ae120 --- /dev/null +++ b/bruno/Roadiz development app/CustomForm/Retrieves the collection of CustomForm resources-.bru @@ -0,0 +1,22 @@ +meta { + name: Retrieves the collection of CustomForm resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/custom_forms + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~closeDate[archive]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/documents/Retrieves a Document resource-.bru b/bruno/Roadiz development app/Document/Retrieves a Document resource-.bru similarity index 63% rename from bruno/Roadiz development app/api/documents/Retrieves a Document resource-.bru rename to bruno/Roadiz development app/Document/Retrieves a Document resource-.bru index f2816cde..d83a9b0d 100644 --- a/bruno/Roadiz development app/api/documents/Retrieves a Document resource-.bru +++ b/bruno/Roadiz development app/Document/Retrieves a Document resource-.bru @@ -7,13 +7,17 @@ meta { get { url: {{baseUrl}}/api/documents/:id body: none - auth: none + auth: bearer +} + +params:query { + ~_preview: } params:path { - id: 1 + id: } -docs { - Retrieves a Document resource. +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/Document/Retrieves the collection of Document resources-.bru b/bruno/Roadiz development app/Document/Retrieves the collection of Document resources-.bru new file mode 100644 index 00000000..768dbe73 --- /dev/null +++ b/bruno/Roadiz development app/Document/Retrieves the collection of Document resources-.bru @@ -0,0 +1,53 @@ +meta { + name: Retrieves the collection of Document resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/documents + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[createdAt]: + ~order[updatedAt]: + ~order[copyrightValidSince]: + ~order[copyrightValidUntil]: + ~order[filesize]: + ~createdAt[before]: + ~createdAt[strictly_before]: + ~createdAt[after]: + ~createdAt[strictly_after]: + ~updatedAt[before]: + ~updatedAt[strictly_before]: + ~updatedAt[after]: + ~updatedAt[strictly_after]: + ~copyrightValidSince[before]: + ~copyrightValidSince[strictly_before]: + ~copyrightValidSince[after]: + ~copyrightValidSince[strictly_after]: + ~copyrightValidUntil[before]: + ~copyrightValidUntil[strictly_before]: + ~copyrightValidUntil[after]: + ~copyrightValidUntil[strictly_after]: + ~copyrightValid: + ~embedPlatform: + ~embedPlatform[]: + ~filename: + ~mimeType: + ~mimeType[]: + ~not[embedPlatform]: + ~not[embedPlatform][]: + ~not[mimeType]: + ~not[mimeType][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/folders/Retrieves a Folder resource-.bru b/bruno/Roadiz development app/Folder/Retrieves a Folder resource-.bru similarity index 62% rename from bruno/Roadiz development app/api/folders/Retrieves a Folder resource-.bru rename to bruno/Roadiz development app/Folder/Retrieves a Folder resource-.bru index 1feafadc..cb144636 100644 --- a/bruno/Roadiz development app/api/folders/Retrieves a Folder resource-.bru +++ b/bruno/Roadiz development app/Folder/Retrieves a Folder resource-.bru @@ -7,13 +7,17 @@ meta { get { url: {{baseUrl}}/api/folders/:id body: none - auth: none + auth: bearer +} + +params:query { + ~_preview: } params:path { - id: dolor pariatur amet + id: } -docs { - Retrieves a Document resource. +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/Folder/Retrieves the collection of Folder resources-.bru b/bruno/Roadiz development app/Folder/Retrieves the collection of Folder resources-.bru new file mode 100644 index 00000000..e484c342 --- /dev/null +++ b/bruno/Roadiz development app/Folder/Retrieves the collection of Folder resources-.bru @@ -0,0 +1,39 @@ +meta { + name: Retrieves the collection of Folder resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/folders + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[position]: + ~order[createdAt]: + ~order[updatedAt]: + ~parent.id: + ~parent.id[]: + ~parent.folderName: + ~parent.folderName[]: + ~folderName: + ~visible: + ~locked: + ~position[between]: + ~position[gt]: + ~position[gte]: + ~position[lt]: + ~position[lte]: + ~position: + ~position[]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/GroupBlock/Retrieves a GroupBlock resource-.bru b/bruno/Roadiz development app/GroupBlock/Retrieves a GroupBlock resource-.bru new file mode 100644 index 00000000..26b6e886 --- /dev/null +++ b/bruno/Roadiz development app/GroupBlock/Retrieves a GroupBlock resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a GroupBlock resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/group_blocks/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/token.bru b/bruno/Roadiz development app/Login Check/Creates a user token-.bru similarity index 70% rename from bruno/Roadiz development app/api/token.bru rename to bruno/Roadiz development app/Login Check/Creates a user token-.bru index be4c58b8..5ac56e05 100644 --- a/bruno/Roadiz development app/api/token.bru +++ b/bruno/Roadiz development app/Login Check/Creates a user token-.bru @@ -1,5 +1,5 @@ meta { - name: token + name: Creates a user token- type: http seq: 1 } @@ -10,10 +10,6 @@ post { auth: none } -headers { - Accept: application/json -} - body:json { { "username": "{{username}}", @@ -23,5 +19,5 @@ body:json { script:post-response { const data = res.getBody(); - bru.setEnvVar("access_token", data.token); + bru.setEnvVar("token", data.token); } diff --git a/bruno/Roadiz development app/Menu/Retrieves a Menu resource-.bru b/bruno/Roadiz development app/Menu/Retrieves a Menu resource-.bru new file mode 100644 index 00000000..b5ba967d --- /dev/null +++ b/bruno/Roadiz development app/Menu/Retrieves a Menu resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a Menu resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/menus/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/MenuLink/Retrieves a MenuLink resource-.bru b/bruno/Roadiz development app/MenuLink/Retrieves a MenuLink resource-.bru new file mode 100644 index 00000000..f47d57e6 --- /dev/null +++ b/bruno/Roadiz development app/MenuLink/Retrieves a MenuLink resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a MenuLink resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/menu_links/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/Neutral/Retrieves a Neutral resource-.bru b/bruno/Roadiz development app/Neutral/Retrieves a Neutral resource-.bru new file mode 100644 index 00000000..ca68fd87 --- /dev/null +++ b/bruno/Roadiz development app/Neutral/Retrieves a Neutral resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a Neutral resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/neutrals/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/NodesSources/Get available NodesSources archives.bru b/bruno/Roadiz development app/NodesSources/Get available NodesSources archives.bru new file mode 100644 index 00000000..024e5a44 --- /dev/null +++ b/bruno/Roadiz development app/NodesSources/Get available NodesSources archives.bru @@ -0,0 +1,85 @@ +meta { + name: Get available NodesSources archives + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/nodes_sources/archives + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~_locale: + ~title: + ~metaTitle: + ~metaDescription: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[publishedAt]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~publishedAt[archive]: + ~noIndex: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/nodes sources/Retrieves a NodesSources resource-.bru b/bruno/Roadiz development app/NodesSources/Retrieves a NodesSources resource-.bru similarity index 64% rename from bruno/Roadiz development app/api/nodes sources/Retrieves a NodesSources resource-.bru rename to bruno/Roadiz development app/NodesSources/Retrieves a NodesSources resource-.bru index a3ce8086..01f40b7e 100644 --- a/bruno/Roadiz development app/api/nodes sources/Retrieves a NodesSources resource-.bru +++ b/bruno/Roadiz development app/NodesSources/Retrieves a NodesSources resource-.bru @@ -7,13 +7,17 @@ meta { get { url: {{baseUrl}}/api/nodes_sources/:id body: none - auth: none + auth: bearer +} + +params:query { + ~_preview: } params:path { - id: dolor pariatur amet + id: } -docs { - Retrieves a NodesSources resource. +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/NodesSources/Retrieves the collection of NodesSources resources-.bru b/bruno/Roadiz development app/NodesSources/Retrieves the collection of NodesSources resources-.bru new file mode 100644 index 00000000..e7d730f8 --- /dev/null +++ b/bruno/Roadiz development app/NodesSources/Retrieves the collection of NodesSources resources-.bru @@ -0,0 +1,85 @@ +meta { + name: Retrieves the collection of NodesSources resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/nodes_sources + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~_locale: + ~title: + ~metaTitle: + ~metaDescription: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[publishedAt]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~publishedAt[archive]: + ~noIndex: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/NodesSources/Search NodesSources resources.bru b/bruno/Roadiz development app/NodesSources/Search NodesSources resources.bru new file mode 100644 index 00000000..458aacce --- /dev/null +++ b/bruno/Roadiz development app/NodesSources/Search NodesSources resources.bru @@ -0,0 +1,86 @@ +meta { + name: Search NodesSources resources + type: http + seq: 3 +} + +get { + url: {{baseUrl}}/api/nodes_sources/search + body: none + auth: bearer +} + +params:query { + search: + ~page: + ~itemsPerPage: + ~properties[]: + ~_locale: + ~title: + ~metaTitle: + ~metaDescription: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[publishedAt]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~publishedAt[archive]: + ~noIndex: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/NsNode/Retrieves a NsNode resource-.bru b/bruno/Roadiz development app/NsNode/Retrieves a NsNode resource-.bru new file mode 100644 index 00000000..440779c4 --- /dev/null +++ b/bruno/Roadiz development app/NsNode/Retrieves a NsNode resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a NsNode resource- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/ns_nodes/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/Offer/Retrieves a Offer resource-.bru b/bruno/Roadiz development app/Offer/Retrieves a Offer resource-.bru new file mode 100644 index 00000000..f5e661de --- /dev/null +++ b/bruno/Roadiz development app/Offer/Retrieves a Offer resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a Offer resource- + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/offers/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/Offer/Retrieves the collection of Offer resources-.bru b/bruno/Roadiz development app/Offer/Retrieves the collection of Offer resources-.bru new file mode 100644 index 00000000..1053aad5 --- /dev/null +++ b/bruno/Roadiz development app/Offer/Retrieves the collection of Offer resources-.bru @@ -0,0 +1,97 @@ +meta { + name: Retrieves the collection of Offer resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/offers + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[price]: + ~order[publishedAt]: + ~price: + ~price[]: + ~price[between]: + ~price[gt]: + ~price[gte]: + ~price[lt]: + ~price[lte]: + ~layout: + ~layout[]: + ~title: + ~metaTitle: + ~metaDescription: + ~not[layout]: + ~not[layout][]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~publishedAt[archive]: + ~noIndex: + ~_locale: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/Page/Retrieve all Page ressources archives months and years.bru b/bruno/Roadiz development app/Page/Retrieve all Page ressources archives months and years.bru new file mode 100644 index 00000000..63002dfa --- /dev/null +++ b/bruno/Roadiz development app/Page/Retrieve all Page ressources archives months and years.bru @@ -0,0 +1,97 @@ +meta { + name: Retrieve all Page ressources archives months and years + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/pages/archives + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[sticky]: + ~order[stickytest]: + ~order[publishedAt]: + ~sticky: + ~stickytest: + ~noIndex: + ~folderReferences: + ~folderReferences[]: + ~layout: + ~layout[]: + ~mainUser: + ~mainUser[]: + ~title: + ~metaTitle: + ~metaDescription: + ~not[layout]: + ~not[layout][]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~publishedAt[archive]: + ~_locale: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/Page/Retrieves a Page resource-.bru b/bruno/Roadiz development app/Page/Retrieves a Page resource-.bru new file mode 100644 index 00000000..7bd29ebe --- /dev/null +++ b/bruno/Roadiz development app/Page/Retrieves a Page resource-.bru @@ -0,0 +1,23 @@ +meta { + name: Retrieves a Page resource- + type: http + seq: 3 +} + +get { + url: {{baseUrl}}/api/pages/:id + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +params:path { + id: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/Page/Retrieves the collection of Page resources-.bru b/bruno/Roadiz development app/Page/Retrieves the collection of Page resources-.bru new file mode 100644 index 00000000..f7b823b1 --- /dev/null +++ b/bruno/Roadiz development app/Page/Retrieves the collection of Page resources-.bru @@ -0,0 +1,97 @@ +meta { + name: Retrieves the collection of Page resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/pages + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[sticky]: + ~order[stickytest]: + ~order[publishedAt]: + ~sticky: + ~stickytest: + ~noIndex: + ~folderReferences: + ~folderReferences[]: + ~layout: + ~layout[]: + ~mainUser: + ~mainUser[]: + ~title: + ~metaTitle: + ~metaDescription: + ~not[layout]: + ~not[layout][]: + ~publishedAt[before]: + ~publishedAt[strictly_before]: + ~publishedAt[after]: + ~publishedAt[strictly_after]: + ~publishedAt[archive]: + ~_locale: + ~node.id: + ~node.id[]: + ~node.nodeName: + ~node.nodeName[]: + ~node.parent: + ~node.parent[]: + ~node.parent.nodeName: + ~node.parent.nodeName[]: + ~node.nodesTags.tag: + ~node.nodesTags.tag[]: + ~node.nodesTags.tag.tagName: + ~node.nodesTags.tag.tagName[]: + ~node.nodeType: + ~node.nodeType[]: + ~node.nodeType.name: + ~node.nodeType.name[]: + ~translation.id: + ~translation.id[]: + ~translation.locale: + ~translation.locale[]: + ~node.createdAt[before]: + ~node.createdAt[strictly_before]: + ~node.createdAt[after]: + ~node.createdAt[strictly_after]: + ~node.updatedAt[before]: + ~node.updatedAt[strictly_before]: + ~node.updatedAt[after]: + ~node.updatedAt[strictly_after]: + ~order[node.position]: + ~order[node.createdAt]: + ~order[node.updatedAt]: + ~node.visible: + ~node.home: + ~node.nodeType.reachable: + ~node.nodeType.publishable: + ~node.position: + ~node.position[]: + ~node.position[between]: + ~node.position[gt]: + ~node.position[gte]: + ~node.position[lt]: + ~node.position[lte]: + ~not[node.nodeType.name]: + ~not[node.nodeType.name][]: + ~not[node.id]: + ~not[node.id][]: + ~not[node.nodesTags.tag.tagName]: + ~not[node.nodesTags.tag.tagName][]: + ~intersect[node.nodesTags.tag]: + ~intersect[node.nodesTags.tag][]: + ~intersect[node.nodesTags.tag.tagName]: + ~intersect[node.nodesTags.tag.tagName][]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/realms/Retrieves a Realm resource-.bru b/bruno/Roadiz development app/Realm/Retrieves a Realm resource-.bru similarity index 56% rename from bruno/Roadiz development app/api/realms/Retrieves a Realm resource-.bru rename to bruno/Roadiz development app/Realm/Retrieves a Realm resource-.bru index 2fd25e3d..32942a00 100644 --- a/bruno/Roadiz development app/api/realms/Retrieves a Realm resource-.bru +++ b/bruno/Roadiz development app/Realm/Retrieves a Realm resource-.bru @@ -1,15 +1,23 @@ meta { name: Retrieves a Realm resource- type: http - seq: 2 + seq: 1 } get { url: {{baseUrl}}/api/realms/:id body: none - auth: none + auth: bearer +} + +params:query { + ~_preview: } params:path { - id: 4 + id: +} + +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/api/tags/Retrieves a Tag resource-.bru b/bruno/Roadiz development app/Tag/Retrieves a Tag resource-.bru similarity index 61% rename from bruno/Roadiz development app/api/tags/Retrieves a Tag resource-.bru rename to bruno/Roadiz development app/Tag/Retrieves a Tag resource-.bru index f9863244..526ac226 100644 --- a/bruno/Roadiz development app/api/tags/Retrieves a Tag resource-.bru +++ b/bruno/Roadiz development app/Tag/Retrieves a Tag resource-.bru @@ -7,13 +7,17 @@ meta { get { url: {{baseUrl}}/api/tags/:id body: none - auth: none + auth: bearer +} + +params:query { + ~_preview: } params:path { - id: dolor pariatur amet + id: } -docs { - Retrieves a Tag resource. +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/Tag/Retrieves the collection of Tag resources-.bru b/bruno/Roadiz development app/Tag/Retrieves the collection of Tag resources-.bru new file mode 100644 index 00000000..be225d53 --- /dev/null +++ b/bruno/Roadiz development app/Tag/Retrieves the collection of Tag resources-.bru @@ -0,0 +1,61 @@ +meta { + name: Retrieves the collection of Tag resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/tags + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[position]: + ~order[createdAt]: + ~order[updatedAt]: + ~parent.id: + ~parent.id[]: + ~parent.tagName: + ~parent.tagName[]: + ~tagName: + ~nodesTags.node: + ~nodesTags.node[]: + ~nodesTags.node.nodeName: + ~nodesTags.node.nodeName[]: + ~nodesTags.node.parent: + ~nodesTags.node.parent[]: + ~nodesTags.node.parent.nodeName: + ~nodesTags.node.parent.nodeName[]: + ~nodesTags.node.nodeType: + ~nodesTags.node.nodeType[]: + ~nodesTags.node.nodeType.name: + ~nodesTags.node.nodeType.name[]: + ~nodesTags.node.nodesTags.tag: + ~nodesTags.node.nodesTags.tag[]: + ~nodesTags.node.nodesTags.tag.tagName: + ~nodesTags.node.nodesTags.tag.tagName[]: + ~not[parent.id]: + ~not[parent.id][]: + ~not[parent.tagName]: + ~not[parent.tagName][]: + ~visible: + ~locked: + ~nodesTags.node.visible: + ~nodesTags.node.nodeType.reachable: + ~position[between]: + ~position[gt]: + ~position[gte]: + ~position[lt]: + ~position[lte]: + ~position: + ~position[]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/translations/Retrieves a Translation resource-.bru b/bruno/Roadiz development app/Translation/Retrieves a Translation resource-.bru similarity index 64% rename from bruno/Roadiz development app/api/translations/Retrieves a Translation resource-.bru rename to bruno/Roadiz development app/Translation/Retrieves a Translation resource-.bru index 15e914da..6c359fe6 100644 --- a/bruno/Roadiz development app/api/translations/Retrieves a Translation resource-.bru +++ b/bruno/Roadiz development app/Translation/Retrieves a Translation resource-.bru @@ -7,13 +7,17 @@ meta { get { url: {{baseUrl}}/api/translations/:id body: none - auth: none + auth: bearer +} + +params:query { + ~_preview: } params:path { - id: dolor pariatur amet + id: } -docs { - Retrieves a Translation resource. +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/Translation/Retrieves the collection of Translation resources-.bru b/bruno/Roadiz development app/Translation/Retrieves the collection of Translation resources-.bru new file mode 100644 index 00000000..8074a830 --- /dev/null +++ b/bruno/Roadiz development app/Translation/Retrieves the collection of Translation resources-.bru @@ -0,0 +1,33 @@ +meta { + name: Retrieves the collection of Translation resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/translations + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~properties[]: + ~order[createdAt]: + ~order[updatedAt]: + ~order[locale]: + ~order[available]: + ~order[defaultTranslation]: + ~available: + ~defaultTranslation: + ~locale: + ~locale[]: + ~name: + ~name[]: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/User/Create a new public user.bru b/bruno/Roadiz development app/User/Create a new public user.bru new file mode 100644 index 00000000..cc27a163 --- /dev/null +++ b/bruno/Roadiz development app/User/Create a new public user.bru @@ -0,0 +1,20 @@ +meta { + name: Create a new public user + type: http + seq: 4 +} + +post { + url: {{baseUrl}}/api/users/signup + body: none + auth: none +} + +headers { + x-g-recaptcha-response: +} + +script:post-response { + if (res.status === 201) { + } +} diff --git a/bruno/Roadiz development app/api/users/Request a public user email validation token.bru b/bruno/Roadiz development app/User/Request a public user email validation token.bru similarity index 51% rename from bruno/Roadiz development app/api/users/Request a public user email validation token.bru rename to bruno/Roadiz development app/User/Request a public user email validation token.bru index bf037bc0..8ad368d9 100644 --- a/bruno/Roadiz development app/api/users/Request a public user email validation token.bru +++ b/bruno/Roadiz development app/User/Request a public user email validation token.bru @@ -1,21 +1,16 @@ meta { name: Request a public user email validation token type: http - seq: 8 + seq: 6 } post { url: {{baseUrl}}/api/users/validation_request - body: json - auth: bearer + body: none + auth: none } -auth:bearer { - token: {{access_token}} -} - -body:json { - { - "identifier": "{{username}}" +script:post-response { + if (res.status === 201) { } } diff --git a/bruno/Roadiz development app/api/users/Request a public user new password.bru b/bruno/Roadiz development app/User/Request a public user new password.bru similarity index 59% rename from bruno/Roadiz development app/api/users/Request a public user new password.bru rename to bruno/Roadiz development app/User/Request a public user new password.bru index 37b06617..989a7084 100644 --- a/bruno/Roadiz development app/api/users/Request a public user new password.bru +++ b/bruno/Roadiz development app/User/Request a public user new password.bru @@ -1,21 +1,20 @@ meta { name: Request a public user new password type: http - seq: 7 + seq: 2 } post { url: {{baseUrl}}/api/users/password_request - body: json + body: none auth: none } headers { - x-g-recaptcha-response: test + x-g-recaptcha-response: } -body:json { - { - "identifier": "{{username}}" +script:post-response { + if (res.status === 201) { } } diff --git a/bruno/Roadiz development app/User/Reset a public user password.bru b/bruno/Roadiz development app/User/Reset a public user password.bru new file mode 100644 index 00000000..712958ee --- /dev/null +++ b/bruno/Roadiz development app/User/Reset a public user password.bru @@ -0,0 +1,16 @@ +meta { + name: Reset a public user password + type: http + seq: 3 +} + +put { + url: {{baseUrl}}/api/users/password_reset + body: none + auth: none +} + +script:post-response { + if (res.status === 200) { + } +} diff --git a/bruno/Roadiz development app/api/users/Get a single user.bru b/bruno/Roadiz development app/User/Retrieves a User resource-.bru similarity index 55% rename from bruno/Roadiz development app/api/users/Get a single user.bru rename to bruno/Roadiz development app/User/Retrieves a User resource-.bru index 0cfaa977..fd06e5d2 100644 --- a/bruno/Roadiz development app/api/users/Get a single user.bru +++ b/bruno/Roadiz development app/User/Retrieves a User resource-.bru @@ -1,7 +1,7 @@ meta { - name: Get a single user + name: Retrieves a User resource- type: http - seq: 1 + seq: 7 } get { @@ -10,10 +10,14 @@ get { auth: bearer } +params:query { + ~_preview: +} + params:path { - id: 2 + id: } auth:bearer { - token: {{access_token}} + token: {{token}} } diff --git a/bruno/Roadiz development app/User/Retrieves the collection of User resources-.bru b/bruno/Roadiz development app/User/Retrieves the collection of User resources-.bru new file mode 100644 index 00000000..b75efc46 --- /dev/null +++ b/bruno/Roadiz development app/User/Retrieves the collection of User resources-.bru @@ -0,0 +1,21 @@ +meta { + name: Retrieves the collection of User resources- + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/users + body: none + auth: bearer +} + +params:query { + ~page: + ~itemsPerPage: + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/User/Validate a public user email.bru b/bruno/Roadiz development app/User/Validate a public user email.bru new file mode 100644 index 00000000..a9d0905f --- /dev/null +++ b/bruno/Roadiz development app/User/Validate a public user email.bru @@ -0,0 +1,16 @@ +meta { + name: Validate a public user email + type: http + seq: 5 +} + +put { + url: {{baseUrl}}/api/users/validate + body: none + auth: none +} + +script:post-response { + if (res.status === 200) { + } +} diff --git a/bruno/Roadiz development app/UserOutput/Get current user -JWT- information.bru b/bruno/Roadiz development app/UserOutput/Get current user -JWT- information.bru new file mode 100644 index 00000000..27e4d4d4 --- /dev/null +++ b/bruno/Roadiz development app/UserOutput/Get current user -JWT- information.bru @@ -0,0 +1,19 @@ +meta { + name: Get current user -JWT- information + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/me + body: none + auth: bearer +} + +params:query { + ~_preview: +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/web_response/Get a WebResponse resource by its path.bru b/bruno/Roadiz development app/WebResponse/Get a Page by its path wrapped in a WebResponse object.bru similarity index 74% rename from bruno/Roadiz development app/api/web_response/Get a WebResponse resource by its path.bru rename to bruno/Roadiz development app/WebResponse/Get a Page by its path wrapped in a WebResponse object.bru index e1a2b001..ea0b7def 100644 --- a/bruno/Roadiz development app/api/web_response/Get a WebResponse resource by its path.bru +++ b/bruno/Roadiz development app/WebResponse/Get a Page by its path wrapped in a WebResponse object.bru @@ -1,7 +1,7 @@ meta { - name: Get a WebResponse resource by its path + name: Get a Page by its path wrapped in a WebResponse object type: http - seq: 2 + seq: 1 } get { @@ -27,11 +27,6 @@ params:query { ~_locale: zh } -headers { - ~Accept: application/json -} - -docs { - Get a NodesSources resource by its path instead of its Id - +auth:bearer { + token: {{token}} } diff --git a/bruno/Roadiz development app/WebResponse/[Auth] Get a Page by its path wrapped in a WebResponse object.bru b/bruno/Roadiz development app/WebResponse/[Auth] Get a Page by its path wrapped in a WebResponse object.bru new file mode 100644 index 00000000..6b400156 --- /dev/null +++ b/bruno/Roadiz development app/WebResponse/[Auth] Get a Page by its path wrapped in a WebResponse object.bru @@ -0,0 +1,32 @@ +meta { + name: [Auth] Get a Page by its path wrapped in a WebResponse object + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/web_response_by_path?path=/&_preview=1 + body: none + auth: bearer +} + +params:query { + path: / + _preview: 1 + ~path: /articles/article-with-attributes + ~properties[]: item + ~properties[item]: title + ~properties[]: blocks + ~properties[item]: url + ~path: /contact + ~path: /fr/articles/article-with-attributes + ~testsd: sd + ~path: /fr/articles + ~properties[item][]: nodeReferences + ~path: /data:image/svg-xml + ~_locale: zh +} + +auth:bearer { + token: {{token}} +} diff --git a/bruno/Roadiz development app/api/articles/Articles archives.bru b/bruno/Roadiz development app/api/articles/Articles archives.bru deleted file mode 100644 index 862e4181..00000000 --- a/bruno/Roadiz development app/api/articles/Articles archives.bru +++ /dev/null @@ -1,19 +0,0 @@ -meta { - name: Articles archives - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/articles/archives?_locale=en&node.parent.nodeName=articles - body: none - auth: none -} - -params:query { - _locale: en - node.parent.nodeName: articles - ~_preview: 1 - ~node.tags.tagName: modi - ~properties[]: year -} diff --git a/bruno/Roadiz development app/api/articles/Get article collection.bru b/bruno/Roadiz development app/api/articles/Get article collection.bru deleted file mode 100644 index d550965c..00000000 --- a/bruno/Roadiz development app/api/articles/Get article collection.bru +++ /dev/null @@ -1,20 +0,0 @@ -meta { - name: Get article collection - type: http - seq: 2 -} - -get { - url: {{baseUrl}}/api/articles?_locale=en&properties[]=title&order[publishedAt]=desc&properties[]=publishedAt - body: none - auth: none -} - -params:query { - _locale: en - properties[]: title - order[publishedAt]: desc - properties[]: publishedAt - ~_preview: 1 - ~unpublishedAt[after]: now -} diff --git a/bruno/Roadiz development app/api/attribute values/-Auth- Retrieves the collection of Attribute Values resources-.bru b/bruno/Roadiz development app/api/attribute values/-Auth- Retrieves the collection of Attribute Values resources-.bru deleted file mode 100644 index 0d401321..00000000 --- a/bruno/Roadiz development app/api/attribute values/-Auth- Retrieves the collection of Attribute Values resources-.bru +++ /dev/null @@ -1,31 +0,0 @@ -meta { - name: -Auth- Retrieves the collection of Attribute Values resources- - type: http - seq: 2 -} - -get { - url: {{baseUrl}}/api/attribute_values?_locale=en&node=/api/nodes/93&order[position]=asc - body: none - auth: bearer -} - -params:query { - _locale: en - node: /api/nodes/93 - order[position]: asc - ~page: 1 - ~itemsPerPage: 30 - ~attributeValueTranslations.value: Zeiss - ~attribute.code: livraison - ~attributeValueTranslations.value[lte]: 2022 - ~exists[attributeValueTranslations.value]: true -} - -auth:bearer { - token: {{access_token}} -} - -docs { - Retrieves the collection of Document resources. -} diff --git a/bruno/Roadiz development app/api/attribute values/Retrieves an Attribute Value resource-.bru b/bruno/Roadiz development app/api/attribute values/Retrieves an Attribute Value resource-.bru deleted file mode 100644 index 8b1a643a..00000000 --- a/bruno/Roadiz development app/api/attribute values/Retrieves an Attribute Value resource-.bru +++ /dev/null @@ -1,19 +0,0 @@ -meta { - name: Retrieves an Attribute Value resource- - type: http - seq: 3 -} - -get { - url: {{baseUrl}}/api/attribute_values/:id - body: none - auth: none -} - -params:path { - id: 25 -} - -docs { - Retrieves a Document resource. -} diff --git a/bruno/Roadiz development app/api/attribute values/Retrieves the collection of Attribute Values resources-.bru b/bruno/Roadiz development app/api/attribute values/Retrieves the collection of Attribute Values resources-.bru deleted file mode 100644 index 93c12ede..00000000 --- a/bruno/Roadiz development app/api/attribute values/Retrieves the collection of Attribute Values resources-.bru +++ /dev/null @@ -1,27 +0,0 @@ -meta { - name: Retrieves the collection of Attribute Values resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/attribute_values?_locale=en&node=/api/nodes/93&order[position]=asc - body: none - auth: none -} - -params:query { - _locale: en - node: /api/nodes/93 - order[position]: asc - ~page: 1 - ~itemsPerPage: 30 - ~attributeValueTranslations.value: Zeiss - ~attribute.code: livraison - ~attributeValueTranslations.value[lte]: 2022 - ~exists[attributeValueTranslations.value]: true -} - -docs { - Retrieves the collection of Document resources. -} diff --git a/bruno/Roadiz development app/api/contact form/api_contact_form_definition.bru b/bruno/Roadiz development app/api/contact form/api_contact_form_definition.bru deleted file mode 100644 index 2f64f08f..00000000 --- a/bruno/Roadiz development app/api/contact form/api_contact_form_definition.bru +++ /dev/null @@ -1,11 +0,0 @@ -meta { - name: api_contact_form_definition - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/contact_form/definition - body: none - auth: none -} diff --git a/bruno/Roadiz development app/api/contact form/api_contact_form_post.bru b/bruno/Roadiz development app/api/contact form/api_contact_form_post.bru deleted file mode 100644 index 7b981b43..00000000 --- a/bruno/Roadiz development app/api/contact form/api_contact_form_post.bru +++ /dev/null @@ -1,22 +0,0 @@ -meta { - name: api_contact_form_post - type: http - seq: 2 -} - -post { - url: {{baseUrl}}/api/contact_form/post - body: multipartForm - auth: none -} - -body:multipart-form { - form[last_name]: Maupate - form[first_name]: Ambroise - form[email]: a@a.a - form[message]: sadasd - consent: 1 - form[file]: @file(/home/ambroisemaupate/Pictures/mike-hindle-NUnAQqww6ww-unsplash.jpg) - ~g-recaptcha-response: - ~form[g-recaptcha-response]: asdfasdf -} diff --git a/bruno/Roadiz development app/api/custom forms/Custom form POST.bru b/bruno/Roadiz development app/api/custom forms/Custom form POST.bru deleted file mode 100644 index ea738997..00000000 --- a/bruno/Roadiz development app/api/custom forms/Custom form POST.bru +++ /dev/null @@ -1,30 +0,0 @@ -meta { - name: Custom form POST - type: http - seq: 2 -} - -post { - url: {{baseUrl}}/api/custom_forms/:id/post?_locale=en - body: multipartForm - auth: none -} - -params:query { - _locale: en -} - -params:path { - id: 3 -} - -headers { - Accept: application/ld+json -} - -body:multipart-form { - email: ambroise@roadiz.io - untitled_field23423kase_flkasdfa_sdfasdf: sadfasdfasdf - ~subject: Ambroise - ~test[fichier]: @file(/home/ambroise/Pictures/Screenshots/Screenshot from 2022-08-05 11-26-38.png) -} diff --git a/bruno/Roadiz development app/api/custom forms/Custom form definition.bru b/bruno/Roadiz development app/api/custom forms/Custom form definition.bru deleted file mode 100644 index 4c686023..00000000 --- a/bruno/Roadiz development app/api/custom forms/Custom form definition.bru +++ /dev/null @@ -1,23 +0,0 @@ -meta { - name: Custom form definition - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/custom_forms/:id/definition?_locale=fr - body: none - auth: none -} - -params:query { - _locale: fr -} - -params:path { - id: 2 -} - -headers { - Accept: application/ld+json -} diff --git a/bruno/Roadiz development app/api/documents/Retrieves the collection of Document resources-.bru b/bruno/Roadiz development app/api/documents/Retrieves the collection of Document resources-.bru deleted file mode 100644 index fcc1ca88..00000000 --- a/bruno/Roadiz development app/api/documents/Retrieves the collection of Document resources-.bru +++ /dev/null @@ -1,28 +0,0 @@ -meta { - name: Retrieves the collection of Document resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/documents?_locale=fr - body: none - auth: none -} - -params:query { - _locale: fr - ~page: 1 - ~itemsPerPage: 30 - ~filename: example - ~copyrightValidUntil[after]: now - ~copyrightValidSince[before]: now - ~intersect[folders.folderName]: photos - ~properties[]: relativePath - ~folders.folderName: chiens - ~copyrightValid: 0 -} - -docs { - Retrieves the collection of Document resources. -} diff --git a/bruno/Roadiz development app/api/folders/Retrieves the collection of Folder resources-.bru b/bruno/Roadiz development app/api/folders/Retrieves the collection of Folder resources-.bru deleted file mode 100644 index 248c6f99..00000000 --- a/bruno/Roadiz development app/api/folders/Retrieves the collection of Folder resources-.bru +++ /dev/null @@ -1,22 +0,0 @@ -meta { - name: Retrieves the collection of Folder resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/folders?_locale=en - body: none - auth: none -} - -params:query { - _locale: en - ~page: 1 - ~itemsPerPage: 30 - ~filename: fevre -} - -docs { - Retrieves the collection of Document resources. -} diff --git a/bruno/Roadiz development app/api/nodes sources/Retrieves the Archives of NodesSources.bru b/bruno/Roadiz development app/api/nodes sources/Retrieves the Archives of NodesSources.bru deleted file mode 100644 index 871fbcff..00000000 --- a/bruno/Roadiz development app/api/nodes sources/Retrieves the Archives of NodesSources.bru +++ /dev/null @@ -1,78 +0,0 @@ -meta { - name: Retrieves the Archives of NodesSources - type: http - seq: 2 -} - -get { - url: {{baseUrl}}/api/nodes_sources/archives - body: none - auth: none -} - -params:query { - ~page: 1 - ~itemsPerPage: 30 - ~properties[]: ex veniam cupidatat ut - ~properties[]: title - ~_locale: en - ~node.id: 24046928 - ~node.id[]: -88680602 - ~node.id[]: -1762450 - ~node.nodeName: dolor pariatur amet - ~node.nodeName[]: ex veniam cupidatat ut - ~node.nodeName[]: velit minim ad - ~node.parent: dolor pariatur amet - ~node.parent[]: ex veniam cupidatat ut - ~node.parent[]: velit minim ad - ~node.parent.nodeName: dolor pariatur amet - ~node.parent.nodeName[]: ex veniam cupidatat ut - ~node.parent.nodeName[]: velit minim ad - ~node.tags: dolor pariatur amet - ~node.tags[]: ex veniam cupidatat ut - ~node.tags[]: velit minim ad - ~intersect[node.tags.tagName]: categories-fr - ~node.tags.tagName: modi - ~node.tags.tagName[]: velit minim ad - ~node.nodeType: dolor pariatur amet - ~node.nodeType[]: ex veniam cupidatat ut - ~node.nodeType[]: velit minim ad - ~node.nodeType.name: dolor pariatur amet - ~node.nodeType.name[]: ex veniam cupidatat ut - ~node.nodeType.name[]: velit minim ad - ~translation.id: 24046928 - ~translation.id[]: -88680602 - ~translation.id[]: -1762450 - ~translation.locale: dolor pariatur amet - ~translation.locale[]: ex veniam cupidatat ut - ~translation.locale[]: velit minim ad - ~title: dolor pariatur amet - ~metaTitle: dolor pariatur amet - ~metaDescription: dolor pariatur amet - ~order[node.position]: desc - ~order[node.createdAt]: desc - ~order[node.updatedAt]: desc - ~order[publishedAt]: desc - ~node.createdAt[before]: dolor pariatur amet - ~node.createdAt[strictly_before]: dolor pariatur amet - ~node.createdAt[after]: dolor pariatur amet - ~node.createdAt[strictly_after]: dolor pariatur amet - ~node.updatedAt[before]: dolor pariatur amet - ~node.updatedAt[strictly_before]: dolor pariatur amet - ~node.updatedAt[after]: dolor pariatur amet - ~node.updatedAt[strictly_after]: dolor pariatur amet - ~publishedAt[before]: dolor pariatur amet - ~publishedAt[strictly_before]: dolor pariatur amet - ~publishedAt[after]: dolor pariatur amet - ~publishedAt[strictly_after]: dolor pariatur amet - ~node.visible: true - ~node.home: true - ~node.nodeType.reachable: true - ~node.nodeType.publishable: true - ~publishedAt[archive]: 2022-01 - ~publishedAt[after]: 2020-01-01 -} - -docs { - Retrieves the collection of NodesSources resources. -} diff --git a/bruno/Roadiz development app/api/nodes sources/Retrieves the collection of NodesSources resources-.bru b/bruno/Roadiz development app/api/nodes sources/Retrieves the collection of NodesSources resources-.bru deleted file mode 100644 index 93bb1d38..00000000 --- a/bruno/Roadiz development app/api/nodes sources/Retrieves the collection of NodesSources resources-.bru +++ /dev/null @@ -1,79 +0,0 @@ -meta { - name: Retrieves the collection of NodesSources resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/nodes_sources?page=1&itemsPerPage=30&properties[node][]=updatedAt&noIndex=0&_locale=fr&node.nodeType.reachable=true - body: none - auth: none -} - -params:query { - page: 1 - itemsPerPage: 30 - properties[node][]: updatedAt - noIndex: 0 - _locale: fr - node.nodeType.reachable: true - ~node.nodeName: dolor pariatur amet - ~node.nodeName[]: ex veniam cupidatat ut - ~node.nodeName[]: velit minim ad - ~node.parent: dolor pariatur amet - ~node.parent[]: ex veniam cupidatat ut - ~node.parent[]: velit minim ad - ~node.parent.nodeName: dolor pariatur amet - ~node.parent.nodeName[]: ex veniam cupidatat ut - ~node.parent.nodeName[]: velit minim ad - ~node.tags: dolor pariatur amet - ~node.tags[]: ex veniam cupidatat ut - ~node.tags[]: velit minim ad - ~intersect[node.tags.tagName]: categories-fr - ~node.nodesTags.tag.tagName: quis - ~node.tags.tagName[]: velit minim ad - ~node.nodeType: dolor pariatur amet - ~node.nodeType[]: ex veniam cupidatat ut - ~node.nodeType[]: velit minim ad - ~node.nodeType.name: dolor pariatur amet - ~node.nodeType.name[]: ex veniam cupidatat ut - ~node.nodeType.name[]: velit minim ad - ~translation.locale: dolor pariatur amet - ~translation.locale[]: ex veniam cupidatat ut - ~translation.locale[]: velit minim ad - ~title: dolor pariatur amet - ~metaTitle: dolor pariatur amet - ~metaDescription: dolor pariatur amet - ~order[node.position]: desc - ~order[node.createdAt]: desc - ~order[node.updatedAt]: desc - ~order[publishedAt]: desc - ~node.createdAt[before]: dolor pariatur amet - ~node.createdAt[strictly_before]: dolor pariatur amet - ~node.createdAt[after]: dolor pariatur amet - ~node.createdAt[strictly_after]: dolor pariatur amet - ~node.updatedAt[before]: dolor pariatur amet - ~node.updatedAt[strictly_before]: dolor pariatur amet - ~node.updatedAt[after]: dolor pariatur amet - ~node.updatedAt[strictly_after]: dolor pariatur amet - ~publishedAt[before]: dolor pariatur amet - ~publishedAt[strictly_before]: dolor pariatur amet - ~publishedAt[after]: dolor pariatur amet - ~publishedAt[strictly_after]: dolor pariatur amet - ~node.visible: true - ~node.home: true - ~node.nodeType.publishable: true - ~publishedAt[archive]: 2022-06 - ~publishedAt[after]: 2020-01-01 - ~not[node.nodeType.name]: Page - ~not[node.nodeType.name]: Offer - ~noIndex: 1 -} - -headers { - Accept: application/ld+json -} - -docs { - Retrieves the collection of NodesSources resources. -} diff --git a/bruno/Roadiz development app/api/nodes sources/Search NodesSources resources.bru b/bruno/Roadiz development app/api/nodes sources/Search NodesSources resources.bru deleted file mode 100644 index d37f6158..00000000 --- a/bruno/Roadiz development app/api/nodes sources/Search NodesSources resources.bru +++ /dev/null @@ -1,25 +0,0 @@ -meta { - name: Search NodesSources resources - type: http - seq: 3 -} - -get { - url: {{baseUrl}}/api/nodes_sources/search?search=test&page=1 - body: none - auth: none -} - -params:query { - search: test - page: 1 - ~itemsPerPage: 30 - ~properties[]: ex veniam cupidatat ut - ~properties[]: velit minim ad - ~_locale: en -} - -docs { - Search NodesSources resources using **Solr** full-text search engine - -} diff --git a/bruno/Roadiz development app/api/realms/Retrieves the collection of Realm resources-.bru b/bruno/Roadiz development app/api/realms/Retrieves the collection of Realm resources-.bru deleted file mode 100644 index 1b4b9291..00000000 --- a/bruno/Roadiz development app/api/realms/Retrieves the collection of Realm resources-.bru +++ /dev/null @@ -1,11 +0,0 @@ -meta { - name: Retrieves the collection of Realm resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/realms - body: none - auth: none -} diff --git a/bruno/Roadiz development app/api/tags/Retrieves the collection of Tag resources-.bru b/bruno/Roadiz development app/api/tags/Retrieves the collection of Tag resources-.bru deleted file mode 100644 index 0b6276c5..00000000 --- a/bruno/Roadiz development app/api/tags/Retrieves the collection of Tag resources-.bru +++ /dev/null @@ -1,23 +0,0 @@ -meta { - name: Retrieves the collection of Tag resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/tags?_locale=fr&nodesTags.node.nodeType.name=Page&nodesTags.node.visible=0 - body: none - auth: none -} - -params:query { - _locale: fr - nodesTags.node.nodeType.name: Page - nodesTags.node.visible: 0 - ~page: 1 - ~itemsPerPage: 30 -} - -docs { - Retrieves the collection of Tag resources. -} diff --git a/bruno/Roadiz development app/api/translations/Retrieves the collection of Translation resources-.bru b/bruno/Roadiz development app/api/translations/Retrieves the collection of Translation resources-.bru deleted file mode 100644 index 2766d520..00000000 --- a/bruno/Roadiz development app/api/translations/Retrieves the collection of Translation resources-.bru +++ /dev/null @@ -1,20 +0,0 @@ -meta { - name: Retrieves the collection of Translation resources- - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/translations?page=1&itemsPerPage=30 - body: none - auth: none -} - -params:query { - page: 1 - itemsPerPage: 30 -} - -docs { - Retrieves the collection of Translation resources. -} diff --git a/bruno/Roadiz development app/api/users/Check a public login-link.bru b/bruno/Roadiz development app/api/users/Check a public login-link.bru deleted file mode 100644 index 7c3ae85b..00000000 --- a/bruno/Roadiz development app/api/users/Check a public login-link.bru +++ /dev/null @@ -1,30 +0,0 @@ -meta { - name: Check a public login-link - type: http - seq: 10 -} - -post { - url: {{baseUrl}}/api/users/login_link_check - body: formUrlEncoded - auth: none -} - -params:query { - _locale: fr -} - -headers { - x-g-recaptcha-response: test -} - -body:form-urlencoded { - user: test3@test.test - expires: 1726163298 - hash: 63c1K5rt7Bswx5jCE-HpP3RI5Y843dgRtcCNiXrWrQ~PFGtvAdPfe7dCJ9ic6QyiGmN5sDG9nPnYZpqEykAmpQ~ -} - -script:post-response { - const data = res.getBody(); - bru.setEnvVar("access_token", data.token); -} diff --git a/bruno/Roadiz development app/api/users/Create a new public passwordless user.bru b/bruno/Roadiz development app/api/users/Create a new public passwordless user.bru deleted file mode 100644 index 739e26a1..00000000 --- a/bruno/Roadiz development app/api/users/Create a new public passwordless user.bru +++ /dev/null @@ -1,35 +0,0 @@ -meta { - name: Create a new public passwordless user - type: http - seq: 9 -} - -post { - url: {{baseUrl}}/api/users/signup?_locale=fr - body: json - auth: none -} - -params:query { - _locale: fr -} - -headers { - x-g-recaptcha-response: test -} - -body:json { - { - "email": "test3@test.test", - "firstName": "Ambroise", - "lastName": "Maupate", - "company": "Rezo Zero", - "metadata": { - "press": { - "press": true, - "educational": false - }, - "educational": false - } - } -} diff --git a/bruno/Roadiz development app/api/users/Create a new public user.bru b/bruno/Roadiz development app/api/users/Create a new public user.bru deleted file mode 100644 index 9afdb420..00000000 --- a/bruno/Roadiz development app/api/users/Create a new public user.bru +++ /dev/null @@ -1,36 +0,0 @@ -meta { - name: Create a new public user - type: http - seq: 4 -} - -post { - url: {{baseUrl}}/api/users/signup?_locale=fr - body: json - auth: none -} - -params:query { - _locale: fr -} - -headers { - x-g-recaptcha-response: test -} - -body:json { - { - "email": "test@test.test", - "plainPassword": "testTest69001", - "firstName": "Ambroise", - "lastName": "Maupate", - "company": "Rezo Zero", - "metadata": { - "press": { - "press": true, - "educational": false - }, - "educational": false - } - } -} diff --git a/bruno/Roadiz development app/api/users/Get current user JWT information.bru b/bruno/Roadiz development app/api/users/Get current user JWT information.bru deleted file mode 100644 index f2e42666..00000000 --- a/bruno/Roadiz development app/api/users/Get current user JWT information.bru +++ /dev/null @@ -1,15 +0,0 @@ -meta { - name: Get current user JWT information - type: http - seq: 3 -} - -get { - url: {{baseUrl}}/api/me - body: none - auth: bearer -} - -auth:bearer { - token: {{access_token}} -} diff --git a/bruno/Roadiz development app/api/users/Get users collection.bru b/bruno/Roadiz development app/api/users/Get users collection.bru deleted file mode 100644 index 0b4d7840..00000000 --- a/bruno/Roadiz development app/api/users/Get users collection.bru +++ /dev/null @@ -1,15 +0,0 @@ -meta { - name: Get users collection - type: http - seq: 2 -} - -get { - url: {{baseUrl}}/api/users - body: none - auth: bearer -} - -auth:bearer { - token: {{access_token}} -} diff --git a/bruno/Roadiz development app/api/users/Reset a public user password.bru b/bruno/Roadiz development app/api/users/Reset a public user password.bru deleted file mode 100644 index b80e44a9..00000000 --- a/bruno/Roadiz development app/api/users/Reset a public user password.bru +++ /dev/null @@ -1,18 +0,0 @@ -meta { - name: Reset a public user password - type: http - seq: 6 -} - -put { - url: {{baseUrl}}/api/users/password_reset - body: json - auth: none -} - -body:json { - { - "plainPassword": "{{password}}", - "token": "aKw3-e63E0RQgPi0M-bhy-Hz_Qn4WPJicrTcWfkfpQA" - } -} diff --git a/bruno/Roadiz development app/api/users/Validate a public user email.bru b/bruno/Roadiz development app/api/users/Validate a public user email.bru deleted file mode 100644 index 50daabbe..00000000 --- a/bruno/Roadiz development app/api/users/Validate a public user email.bru +++ /dev/null @@ -1,21 +0,0 @@ -meta { - name: Validate a public user email - type: http - seq: 5 -} - -put { - url: {{baseUrl}}/api/users/validate - body: json - auth: bearer -} - -auth:bearer { - token: {{access_token}} -} - -body:json { - { - "token": "Y_au0OF8MMmM3DZLcwRgmqE_ZR84JPqr-_Fw3bWs2E" - } -} diff --git a/bruno/Roadiz development app/api/web_response/-Auth- WebResponse resource by its path.bru b/bruno/Roadiz development app/api/web_response/-Auth- WebResponse resource by its path.bru deleted file mode 100644 index 47d7855b..00000000 --- a/bruno/Roadiz development app/api/web_response/-Auth- WebResponse resource by its path.bru +++ /dev/null @@ -1,36 +0,0 @@ -meta { - name: -Auth- WebResponse resource by its path - type: http - seq: 3 -} - -get { - url: {{baseUrl}}/api/web_response_by_path?path=/fr/articles/article-with-attributes - body: none - auth: bearer -} - -params:query { - path: /fr/articles/article-with-attributes - ~properties[]: item - ~properties[item]: title - ~properties[]: blocks - ~properties[item]: url - ~password: test - ~path: /contact - ~path: / - ~_preview: 1 -} - -headers { - ~Accept: application/json -} - -auth:bearer { - token: {{access_token}} -} - -docs { - Get a NodesSources resource by its path instead of its Id - -} diff --git a/bruno/Roadiz development app/api/web_response/Common content response.bru b/bruno/Roadiz development app/api/web_response/Common content response.bru deleted file mode 100644 index 33ef9fbf..00000000 --- a/bruno/Roadiz development app/api/web_response/Common content response.bru +++ /dev/null @@ -1,15 +0,0 @@ -meta { - name: Common content response - type: http - seq: 1 -} - -get { - url: {{baseUrl}}/api/common_content?_locale=fr - body: none - auth: none -} - -params:query { - _locale: fr -} diff --git a/bruno/Roadiz development app/environments/Local Dev - Traefik.bru b/bruno/Roadiz development app/environments/Local Dev - Traefik.bru index bcc07311..60d93cbc 100644 --- a/bruno/Roadiz development app/environments/Local Dev - Traefik.bru +++ b/bruno/Roadiz development app/environments/Local Dev - Traefik.bru @@ -2,7 +2,7 @@ vars { baseUrl: http://roadiz-core-app.test } vars:secret [ - access_token, + token, username, password ] diff --git a/bruno/Roadiz development app/environments/Local Dev.bru b/bruno/Roadiz development app/environments/Local Dev.bru index a7d3df27..bdc78cd0 100644 --- a/bruno/Roadiz development app/environments/Local Dev.bru +++ b/bruno/Roadiz development app/environments/Local Dev.bru @@ -2,7 +2,7 @@ vars { baseUrl: http://localhost:8681 } vars:secret [ - access_token, + token, username, password ] diff --git a/bruno/Roadiz development app/environments/Local public user.bru b/bruno/Roadiz development app/environments/Local public user.bru index a7d3df27..bdc78cd0 100644 --- a/bruno/Roadiz development app/environments/Local public user.bru +++ b/bruno/Roadiz development app/environments/Local public user.bru @@ -2,7 +2,7 @@ vars { baseUrl: http://localhost:8681 } vars:secret [ - access_token, + token, username, password ] From 4ee9b5edb127e287a6247cbbf18dff99bd2d627c Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Wed, 4 Dec 2024 01:47:44 +0100 Subject: [PATCH 6/7] chore: Throw 400 when empty search param --- config/api_resources/custom_form.yml | 1 - config/packages/roadiz_rozier.yaml | 3 +-- .../src/Api/ListManager/SolrSearchListManager.php | 5 +++-- .../src/SearchEngine/SolrSearchResultItem.php | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/config/api_resources/custom_form.yml b/config/api_resources/custom_form.yml index 892a3ae9..e1e1e6df 100644 --- a/config/api_resources/custom_form.yml +++ b/config/api_resources/custom_form.yml @@ -38,7 +38,6 @@ resources: type: string example: Doe responses: - 201: ~ 400: description: Posted custom form has errors content: diff --git a/config/packages/roadiz_rozier.yaml b/config/packages/roadiz_rozier.yaml index 5269db77..ab7312eb 100644 --- a/config/packages/roadiz_rozier.yaml +++ b/config/packages/roadiz_rozier.yaml @@ -62,8 +62,7 @@ roadiz_rozier: name: 'deleted.nodes' route: nodesHomeDeletedPage icon: uk-icon-rz-deleted-nodes - roles: - - EMPTY_TRASH + roles: ~ search_nodes: name: 'search.nodes' route: searchNodePage diff --git a/lib/RoadizCoreBundle/src/Api/ListManager/SolrSearchListManager.php b/lib/RoadizCoreBundle/src/Api/ListManager/SolrSearchListManager.php index d14e89fb..e0a93137 100644 --- a/lib/RoadizCoreBundle/src/Api/ListManager/SolrSearchListManager.php +++ b/lib/RoadizCoreBundle/src/Api/ListManager/SolrSearchListManager.php @@ -9,11 +9,12 @@ use RZ\Roadiz\CoreBundle\SearchEngine\SearchResultsInterface; use Symfony\Component\DependencyInjection\Attribute\Exclude; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; #[Exclude] final class SolrSearchListManager extends AbstractEntityListManager { - private ?SearchResultsInterface $searchResults; + private ?SearchResultsInterface $searchResults = null; private ?string $query = null; public function __construct( @@ -34,7 +35,7 @@ public function handle(bool $disabled = false): void $this->handleRequestQuery($disabled); if (null === $this->query) { - throw new \InvalidArgumentException('Cannot handle a NULL query.'); + throw new BadRequestHttpException('Search param is required.'); } /* * Query must be longer than 3 chars or Solr might crash diff --git a/lib/RoadizCoreBundle/src/SearchEngine/SolrSearchResultItem.php b/lib/RoadizCoreBundle/src/SearchEngine/SolrSearchResultItem.php index b25d94c6..a25feab0 100644 --- a/lib/RoadizCoreBundle/src/SearchEngine/SolrSearchResultItem.php +++ b/lib/RoadizCoreBundle/src/SearchEngine/SolrSearchResultItem.php @@ -14,15 +14,15 @@ #[ApiResource( stateless: true, )] -final class SolrSearchResultItem +final readonly class SolrSearchResultItem { /** * @param T $item * @param array> $highlighting */ public function __construct( - private readonly object $item, - private readonly array $highlighting = [], + private object $item, + private array $highlighting = [], ) { } From f1efd313109915b42defb1e039755a94a19c2908 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Wed, 4 Dec 2024 02:10:18 +0100 Subject: [PATCH 7/7] feat: Migrate Node::status to NodeStatus enum, reduced int to smallint when possible --- .../Core/AbstractEntities/AbstractField.php | 7 +- .../migrations/Version20241204010215.php | 41 +++++++++ .../NodesSourcesSearchController.php | 2 + .../AttributeValueQueryExtension.php | 9 +- .../src/Api/Extension/NodeQueryExtension.php | 9 +- .../Extension/NodesSourcesQueryExtension.php | 12 +-- .../Api/Extension/NodesTagsQueryExtension.php | 6 +- .../src/Console/NodesEmptyTrashCommand.php | 7 +- lib/RoadizCoreBundle/src/Entity/Document.php | 7 +- lib/RoadizCoreBundle/src/Entity/Node.php | 82 ++++++++++------- .../src/Entity/NodeTypeField.php | 7 +- .../src/Entity/Redirection.php | 3 +- lib/RoadizCoreBundle/src/Entity/Setting.php | 3 +- lib/RoadizCoreBundle/src/Enum/NodeStatus.php | 88 +++++++++++++++++++ .../src/Form/NodeStatesType.php | 15 +--- .../src/Model/NodeTreeDto.php | 18 ++-- .../src/Node/NodeDuplicator.php | 3 +- .../src/Repository/NodesSourcesRepository.php | 10 ++- .../src/Repository/StatusAwareRepository.php | 7 +- .../SearchEngine/NodeSourceSearchHandler.php | 3 +- .../DefaultNodesSourcesIndexingSubscriber.php | 2 +- .../src/Workflow/NodeWorkflow.php | 49 +++++------ .../src/TwigExtension/RozierExtension.php | 10 +-- .../AjaxControllers/AjaxNodesController.php | 2 +- .../AjaxNodesExplorerController.php | 3 +- .../src/Controllers/Nodes/NodesController.php | 11 +-- .../Nodes/NodesTreesController.php | 9 +- lib/Rozier/src/Forms/Node/AddNodeType.php | 10 +-- lib/Rozier/src/Forms/NodeTreeType.php | 9 +- src/DataFixtures/ArticleFixtures.php | 6 +- src/DataFixtures/OfferFixtures.php | 6 +- 31 files changed, 304 insertions(+), 152 deletions(-) create mode 100644 lib/RoadizCoreBundle/migrations/Version20241204010215.php create mode 100644 lib/RoadizCoreBundle/src/Enum/NodeStatus.php diff --git a/lib/Models/src/Core/AbstractEntities/AbstractField.php b/lib/Models/src/Core/AbstractEntities/AbstractField.php index 2915da82..b318378f 100644 --- a/lib/Models/src/Core/AbstractEntities/AbstractField.php +++ b/lib/Models/src/Core/AbstractEntities/AbstractField.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Core\AbstractEntities; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; use RZ\Roadiz\Utils\StringHandler; @@ -332,7 +333,11 @@ abstract class AbstractField extends AbstractPositioned protected ?string $defaultValues = null; #[ - ORM\Column(type: 'integer'), + ORM\Column( + type: Types::SMALLINT, + nullable: false, + options: ['default' => AbstractField::STRING_T] + ), Serializer\Groups(['node_type', 'setting']), SymfonySerializer\Groups(['node_type', 'setting']), Serializer\Type('int'), diff --git a/lib/RoadizCoreBundle/migrations/Version20241204010215.php b/lib/RoadizCoreBundle/migrations/Version20241204010215.php new file mode 100644 index 00000000..4cf24130 --- /dev/null +++ b/lib/RoadizCoreBundle/migrations/Version20241204010215.php @@ -0,0 +1,41 @@ +addSql('ALTER TABLE custom_form_fields CHANGE type type SMALLINT DEFAULT 0 NOT NULL'); + $this->addSql('ALTER TABLE documents CHANGE imageWidth imageWidth SMALLINT DEFAULT 0 NOT NULL, CHANGE imageHeight imageHeight SMALLINT DEFAULT 0 NOT NULL'); + $this->addSql('ALTER TABLE node_type_fields CHANGE type type SMALLINT DEFAULT 0 NOT NULL, CHANGE min_length min_length SMALLINT DEFAULT NULL, CHANGE max_length max_length SMALLINT DEFAULT NULL, CHANGE serialization_max_depth serialization_max_depth SMALLINT DEFAULT NULL'); + $this->addSql('ALTER TABLE nodes CHANGE status status SMALLINT DEFAULT 10 NOT NULL'); + $this->addSql('ALTER TABLE redirections CHANGE type type SMALLINT NOT NULL'); + $this->addSql('ALTER TABLE settings CHANGE type type SMALLINT NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE custom_form_fields CHANGE type type INT NOT NULL'); + $this->addSql('ALTER TABLE documents CHANGE imageWidth imageWidth INT DEFAULT 0 NOT NULL, CHANGE imageHeight imageHeight INT DEFAULT 0 NOT NULL'); + $this->addSql('ALTER TABLE node_type_fields CHANGE serialization_max_depth serialization_max_depth INT DEFAULT NULL, CHANGE min_length min_length INT DEFAULT NULL, CHANGE max_length max_length INT DEFAULT NULL, CHANGE type type INT NOT NULL'); + $this->addSql('ALTER TABLE nodes CHANGE status status INT NOT NULL'); + $this->addSql('ALTER TABLE redirections CHANGE type type INT NOT NULL'); + $this->addSql('ALTER TABLE settings CHANGE type type INT NOT NULL'); + } +} diff --git a/lib/RoadizCoreBundle/src/Api/Controller/NodesSourcesSearchController.php b/lib/RoadizCoreBundle/src/Api/Controller/NodesSourcesSearchController.php index e9d4ebab..a21dfde0 100644 --- a/lib/RoadizCoreBundle/src/Api/Controller/NodesSourcesSearchController.php +++ b/lib/RoadizCoreBundle/src/Api/Controller/NodesSourcesSearchController.php @@ -5,6 +5,7 @@ namespace RZ\Roadiz\CoreBundle\Api\Controller; use Doctrine\Persistence\ManagerRegistry; +use RZ\Roadiz\CoreBundle\Api\ListManager\InvalidSearchQueryException; use RZ\Roadiz\CoreBundle\Api\ListManager\SolrPaginator; use RZ\Roadiz\CoreBundle\Api\ListManager\SolrSearchListManager; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; @@ -13,6 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\HttpException; class NodesSourcesSearchController extends AbstractController diff --git a/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php index 94dffeb2..f3fe8b4f 100644 --- a/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php +++ b/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php @@ -12,12 +12,13 @@ use Doctrine\ORM\QueryBuilder; use RZ\Roadiz\CoreBundle\Entity\AttributeValue; use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; -final class AttributeValueQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface +final readonly class AttributeValueQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, + private PreviewResolverInterface $previewResolver, ) { } @@ -69,14 +70,14 @@ private function apply( if ($this->previewResolver->isPreview()) { $queryBuilder ->andWhere($queryBuilder->expr()->lte($joinAlias.'.status', ':status')) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } $queryBuilder ->andWhere($queryBuilder->expr()->eq($joinAlias.'.status', ':status')) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } diff --git a/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php index 2a09dac9..65c08c95 100644 --- a/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php +++ b/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php @@ -12,12 +12,13 @@ use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; -final class NodeQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface +final readonly class NodeQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, + private PreviewResolverInterface $previewResolver, ) { } @@ -44,7 +45,7 @@ private function apply( if ($this->previewResolver->isPreview()) { $queryBuilder ->andWhere($queryBuilder->expr()->lte('o.status', ':status')) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } @@ -60,7 +61,7 @@ private function apply( ->andWhere($queryBuilder->expr()->lte($alias.'.publishedAt', ':lte_published_at')) ->andWhere($queryBuilder->expr()->eq('o.status', ':status')) ->setParameter(':lte_published_at', new \DateTime()) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } diff --git a/lib/RoadizCoreBundle/src/Api/Extension/NodesSourcesQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/NodesSourcesQueryExtension.php index 60f82de9..dd6507a2 100644 --- a/lib/RoadizCoreBundle/src/Api/Extension/NodesSourcesQueryExtension.php +++ b/lib/RoadizCoreBundle/src/Api/Extension/NodesSourcesQueryExtension.php @@ -11,15 +11,15 @@ use ApiPlatform\Metadata\Operation; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; -use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodesSources; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; -final class NodesSourcesQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface +final readonly class NodesSourcesQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface { public function __construct( - private readonly PreviewResolverInterface $previewResolver, - private readonly string $generatedEntityNamespacePattern = '#^App\\\GeneratedEntity\\\NS(?:[a-zA-Z]+)$#', + private PreviewResolverInterface $previewResolver, + private string $generatedEntityNamespacePattern = '#^App\\\GeneratedEntity\\\NS(?:[a-zA-Z]+)$#', ) { } @@ -71,7 +71,7 @@ private function apply( ); $queryBuilder ->andWhere($queryBuilder->expr()->lte($alias.'.status', ':status')) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } @@ -87,7 +87,7 @@ private function apply( ->andWhere($queryBuilder->expr()->lte('o.publishedAt', ':lte_published_at')) ->andWhere($queryBuilder->expr()->eq($alias.'.status', ':status')) ->setParameter(':lte_published_at', new \DateTime()) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } diff --git a/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php index b166c880..cc423464 100644 --- a/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php +++ b/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php @@ -10,8 +10,8 @@ use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface; use ApiPlatform\Metadata\Operation; use Doctrine\ORM\QueryBuilder; -use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\Tag; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; final class NodesTagsQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface @@ -74,14 +74,14 @@ private function apply( if ($this->previewResolver->isPreview()) { $queryBuilder ->andWhere($queryBuilder->expr()->lte($existingNodeJoin->getAlias().'.status', ':status')) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } $queryBuilder ->andWhere($queryBuilder->expr()->eq($existingNodeJoin->getAlias().'.status', ':status')) - ->setParameter(':status', Node::PUBLISHED); + ->setParameter(':status', NodeStatus::PUBLISHED); return; } diff --git a/lib/RoadizCoreBundle/src/Console/NodesEmptyTrashCommand.php b/lib/RoadizCoreBundle/src/Console/NodesEmptyTrashCommand.php index 031b6f9b..3084bc0b 100644 --- a/lib/RoadizCoreBundle/src/Console/NodesEmptyTrashCommand.php +++ b/lib/RoadizCoreBundle/src/Console/NodesEmptyTrashCommand.php @@ -9,6 +9,7 @@ use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\EntityHandler\HandlerFactory; use RZ\Roadiz\CoreBundle\EntityHandler\NodeHandler; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -40,7 +41,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $em = $this->managerRegistry->getManagerForClass(Node::class); $countQb = $this->createNodeQueryBuilder(); $countQuery = $countQb->select($countQb->expr()->count('n')) - ->andWhere($countQb->expr()->eq('n.status', Node::DELETED)) + ->andWhere($countQb->expr()->eq('n.status', ':status')) + ->setParameter('status', NodeStatus::DELETED) ->getQuery(); $emptiedCount = $countQuery->getSingleScalarResult(); if (0 == $emptiedCount) { @@ -64,7 +66,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $qb = $this->createNodeQueryBuilder(); $q = $qb->select('n') - ->andWhere($countQb->expr()->eq('n.status', Node::DELETED)) + ->andWhere($countQb->expr()->eq('n.status', ':status')) + ->setParameter('status', NodeStatus::DELETED) ->getQuery(); foreach ($q->toIterable() as $row) { diff --git a/lib/RoadizCoreBundle/src/Entity/Document.php b/lib/RoadizCoreBundle/src/Entity/Document.php index d7d7039f..aefebf93 100644 --- a/lib/RoadizCoreBundle/src/Entity/Document.php +++ b/lib/RoadizCoreBundle/src/Entity/Document.php @@ -11,6 +11,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; use RZ\Roadiz\Core\AbstractEntities\AbstractDateTimed; @@ -267,7 +268,7 @@ class Document extends AbstractDateTimed implements AdvancedDocumentInterface, H #[Serializer\Groups(['document', 'document_private', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Type('bool')] private bool $private = false; - #[ORM\Column(name: 'imageWidth', type: 'integer', nullable: false, options: ['default' => 0])] + #[ORM\Column(name: 'imageWidth', type: Types::SMALLINT, nullable: false, options: ['default' => 0])] #[SymfonySerializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Type('int')] @@ -276,7 +277,7 @@ class Document extends AbstractDateTimed implements AdvancedDocumentInterface, H example: '1280', )] private int $imageWidth = 0; - #[ORM\Column(name: 'imageHeight', type: 'integer', nullable: false, options: ['default' => 0])] + #[ORM\Column(name: 'imageHeight', type: Types::SMALLINT, nullable: false, options: ['default' => 0])] #[SymfonySerializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Type('int')] @@ -285,7 +286,7 @@ class Document extends AbstractDateTimed implements AdvancedDocumentInterface, H example: '800', )] private int $imageHeight = 0; - #[ORM\Column(name: 'duration', type: 'integer', nullable: false, options: ['default' => 0])] + #[ORM\Column(name: 'duration', type: Types::INTEGER, nullable: false, options: ['default' => 0])] #[SymfonySerializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute'])] #[Serializer\Type('int')] diff --git a/lib/RoadizCoreBundle/src/Entity/Node.php b/lib/RoadizCoreBundle/src/Entity/Node.php index 1bf1cd74..c9e9e683 100644 --- a/lib/RoadizCoreBundle/src/Entity/Node.php +++ b/lib/RoadizCoreBundle/src/Entity/Node.php @@ -11,6 +11,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Loggable\Loggable; use Gedmo\Mapping\Annotation as Gedmo; @@ -22,6 +23,7 @@ use RZ\Roadiz\Core\AbstractEntities\NodeInterface; use RZ\Roadiz\Core\AbstractEntities\TranslationInterface; use RZ\Roadiz\CoreBundle\Api\Filter as RoadizFilter; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Model\AttributableInterface; use RZ\Roadiz\CoreBundle\Model\AttributableTrait; use RZ\Roadiz\CoreBundle\Repository\NodeRepository; @@ -72,10 +74,15 @@ class Node extends AbstractDateTimedPositioned implements LeafInterface, Attribu use LeafTrait; use AttributableTrait; + /** @deprecated Use NodeStatus enum */ public const DRAFT = 10; + /** @deprecated Use NodeStatus enum */ public const PENDING = 20; + /** @deprecated Use NodeStatus enum */ public const PUBLISHED = 30; + /** @deprecated Use NodeStatus enum */ public const ARCHIVED = 40; + /** @deprecated Use NodeStatus enum */ public const DELETED = 50; #[SymfonySerializer\Ignore] @@ -123,12 +130,21 @@ class Node extends AbstractDateTimedPositioned implements LeafInterface, Attribu /** * @internal you should use node Workflow to perform change on status */ - #[ORM\Column(type: 'integer')] + #[ORM\Column( + name: 'status', + type: Types::SMALLINT, + enumType: NodeStatus::class, + options: ['default' => NodeStatus::DRAFT] + )] #[Serializer\Exclude] #[SymfonySerializer\Ignore] - private int $status = Node::DRAFT; + private NodeStatus $status = NodeStatus::DRAFT; - #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0])] + #[ORM\Column( + type: Types::INTEGER, + nullable: false, + options: ['default' => 0] + )] #[Assert\GreaterThanOrEqual(value: 0)] #[Assert\NotNull] #[SymfonySerializer\Ignore] @@ -334,23 +350,13 @@ public function __construct() } /** - * @param int $status + * @deprecated Use NodeStatus enum getLabel method */ - public static function getStatusLabel($status): string + public static function getStatusLabel(int|string $status): string { - $nodeStatuses = [ - static::DRAFT => 'draft', - static::PENDING => 'pending', - static::PUBLISHED => 'published', - static::ARCHIVED => 'archived', - static::DELETED => 'deleted', - ]; - - if (isset($nodeStatuses[$status])) { - return $nodeStatuses[$status]; - } + $status = NodeStatus::tryFrom((int) $status); - throw new \InvalidArgumentException('Status does not exist.'); + return $status->getLabel(); } /** @@ -390,25 +396,41 @@ public function setHome(bool $home): Node return $this; } - public function getStatus(): int + public function getStatus(): NodeStatus { return $this->status; } /** - * @param int|string $status Workflow only use marking places + * @param int|string|NodeStatus $status Workflow only use marking places * * @return $this * * @internal you should use node Workflow to perform change on status */ - public function setStatus(int|string $status): Node + public function setStatus(int|string|NodeStatus $status): Node { - $this->status = (int) $status; + if ($status instanceof NodeStatus) { + $this->status = $status; + } else { + $this->status = NodeStatus::tryFrom((int) $status) ?? NodeStatus::DRAFT; + } return $this; } + public function setStatusAsString(string $name): Node + { + $this->status = NodeStatus::fromName($name); + + return $this; + } + + public function getStatusAsString(): string + { + return $this->status->name; + } + public function getTtl(): int { return $this->ttl ?? 0; @@ -423,22 +445,27 @@ public function setTtl(?int $ttl): Node public function isPublished(): bool { - return Node::PUBLISHED === $this->status; + return $this->status->isPublished(); } public function isPending(): bool { - return Node::PENDING === $this->status; + return $this->status->isPending(); } public function isDraft(): bool { - return Node::DRAFT === $this->status; + return $this->status->isDraft(); } public function isDeleted(): bool { - return Node::DELETED === $this->status; + return $this->status->isDeleted(); + } + + public function isArchived(): bool + { + return $this->status->isArchived(); } public function isLocked(): bool @@ -486,11 +513,6 @@ public function setHidingChildren(bool $hideChildren): static return $this; } - public function isArchived(): bool - { - return Node::ARCHIVED === $this->status; - } - public function isSterile(): bool { return $this->sterile; diff --git a/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php b/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php index b9bbcb06..ec3b331f 100644 --- a/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php +++ b/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\CoreBundle\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface; @@ -101,7 +102,7 @@ class NodeTypeField extends AbstractField implements NodeTypeFieldInterface, Ser Serializer\Groups(['node_type']), SymfonySerializer\Groups(['node_type']), Serializer\Type('int'), - ORM\Column(name: 'serialization_max_depth', type: 'integer', nullable: true) + ORM\Column(name: 'serialization_max_depth', type: Types::SMALLINT, nullable: true) ] private ?int $serializationMaxDepth = null; @@ -114,7 +115,7 @@ class NodeTypeField extends AbstractField implements NodeTypeFieldInterface, Ser private bool $excludedFromSerialization = false; #[ - ORM\Column(name: 'min_length', type: 'integer', nullable: true), + ORM\Column(name: 'min_length', type: Types::SMALLINT, nullable: true), Serializer\Groups(['node_type']), SymfonySerializer\Groups(['node_type']), Serializer\Type('int') @@ -122,7 +123,7 @@ class NodeTypeField extends AbstractField implements NodeTypeFieldInterface, Ser private ?int $minLength = null; #[ - ORM\Column(name: 'max_length', type: 'integer', nullable: true), + ORM\Column(name: 'max_length', type: Types::SMALLINT, nullable: true), Serializer\Groups(['node_type']), SymfonySerializer\Groups(['node_type']), Serializer\Type('int') diff --git a/lib/RoadizCoreBundle/src/Entity/Redirection.php b/lib/RoadizCoreBundle/src/Entity/Redirection.php index bf642a74..aeedd398 100644 --- a/lib/RoadizCoreBundle/src/Entity/Redirection.php +++ b/lib/RoadizCoreBundle/src/Entity/Redirection.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\CoreBundle\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use RZ\Roadiz\Core\AbstractEntities\AbstractDateTimed; use RZ\Roadiz\CoreBundle\Repository\RedirectionRepository; @@ -42,7 +43,7 @@ class Redirection extends AbstractDateTimed #[ORM\JoinColumn(name: 'ns_id', referencedColumnName: 'id', onDelete: 'CASCADE')] private ?NodesSources $redirectNodeSource = null; - #[ORM\Column(type: 'integer')] + #[ORM\Column(type: Types::SMALLINT)] private int $type = 301; public function getQuery(): string diff --git a/lib/RoadizCoreBundle/src/Entity/Setting.php b/lib/RoadizCoreBundle/src/Entity/Setting.php index 63630bbc..21065bfc 100644 --- a/lib/RoadizCoreBundle/src/Entity/Setting.php +++ b/lib/RoadizCoreBundle/src/Entity/Setting.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\CoreBundle\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as Serializer; use RZ\Roadiz\Core\AbstractEntities\AbstractEntity; @@ -92,7 +93,7 @@ class Setting extends AbstractEntity * Value types. * Use NodeTypeField types constants. */ - #[ORM\Column(type: 'integer')] + #[ORM\Column(type: Types::SMALLINT)] #[SymfonySerializer\Groups(['setting'])] #[Serializer\Groups(['setting'])] private int $type = AbstractField::STRING_T; diff --git a/lib/RoadizCoreBundle/src/Enum/NodeStatus.php b/lib/RoadizCoreBundle/src/Enum/NodeStatus.php new file mode 100644 index 00000000..5593658b --- /dev/null +++ b/lib/RoadizCoreBundle/src/Enum/NodeStatus.php @@ -0,0 +1,88 @@ + 'draft', + NodeStatus::PENDING => 'pending', + NodeStatus::PUBLISHED => 'published', + NodeStatus::ARCHIVED => 'archived', + NodeStatus::DELETED => 'deleted', + }; + } + + public static function fromLabel(string $label): self + { + return match (strtolower($label)) { + 'pending' => NodeStatus::PENDING, + 'published' => NodeStatus::PUBLISHED, + 'archived' => NodeStatus::ARCHIVED, + 'deleted' => NodeStatus::DELETED, + default => NodeStatus::DRAFT, + }; + } + + public static function fromName(string $name): self + { + return match (strtoupper($name)) { + 'PENDING' => NodeStatus::PENDING, + 'PUBLISHED' => NodeStatus::PUBLISHED, + 'ARCHIVED' => NodeStatus::ARCHIVED, + 'DELETED' => NodeStatus::DELETED, + default => NodeStatus::DRAFT, + }; + } + + public static function allLabelsAndValues(): array + { + return array_combine( + array_map(fn (NodeStatus $status) => $status->getLabel(), self::cases()), + array_map(fn (NodeStatus $status) => $status->value, self::cases()) + ); + } + + public function isPublished(): bool + { + return NodeStatus::PUBLISHED === $this; + } + + public function isPending(): bool + { + return NodeStatus::PENDING === $this; + } + + public function isDraft(): bool + { + return NodeStatus::DRAFT === $this; + } + + public function isDeleted(): bool + { + return NodeStatus::DELETED === $this; + } + + public function isArchived(): bool + { + return NodeStatus::ARCHIVED === $this; + } + + public function trans(TranslatorInterface $translator, ?string $locale = null): string + { + return $translator->trans($this->getLabel(), locale: $locale); + } +} diff --git a/lib/RoadizCoreBundle/src/Form/NodeStatesType.php b/lib/RoadizCoreBundle/src/Form/NodeStatesType.php index 79b24cec..3d76a523 100644 --- a/lib/RoadizCoreBundle/src/Form/NodeStatesType.php +++ b/lib/RoadizCoreBundle/src/Form/NodeStatesType.php @@ -4,9 +4,9 @@ namespace RZ\Roadiz\CoreBundle\Form; -use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -16,22 +16,15 @@ class NodeStatesType extends AbstractType { public function configureOptions(OptionsResolver $resolver): void { - $choices = []; - $choices[Node::getStatusLabel(Node::DRAFT)] = Node::DRAFT; - $choices[Node::getStatusLabel(Node::PENDING)] = Node::PENDING; - $choices[Node::getStatusLabel(Node::PUBLISHED)] = Node::PUBLISHED; - $choices[Node::getStatusLabel(Node::ARCHIVED)] = Node::ARCHIVED; - $choices[Node::getStatusLabel(Node::DELETED)] = Node::DELETED; - $resolver->setDefaults([ - 'choices' => $choices, + 'class' => NodeStatus::class, 'placeholder' => 'ignore', ]); } public function getParent(): ?string { - return ChoiceType::class; + return EnumType::class; } public function getBlockPrefix(): string diff --git a/lib/RoadizCoreBundle/src/Model/NodeTreeDto.php b/lib/RoadizCoreBundle/src/Model/NodeTreeDto.php index 2bcacd9e..b6c5ead3 100644 --- a/lib/RoadizCoreBundle/src/Model/NodeTreeDto.php +++ b/lib/RoadizCoreBundle/src/Model/NodeTreeDto.php @@ -7,6 +7,7 @@ use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface; use RZ\Roadiz\Core\AbstractEntities\NodeInterface; use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; /** * Doctrine Data transfer object to represent a Node in a tree. @@ -22,7 +23,7 @@ public function __construct( private readonly bool $hideChildren, private readonly bool $home, private readonly bool $visible, - private readonly int $status, + private readonly NodeStatus $status, private readonly ?int $parentId, private readonly string $childrenOrder, private readonly string $childrenOrderDirection, @@ -96,11 +97,16 @@ public function isVisible(): bool return $this->visible; } - public function getStatus(): int + public function getStatus(): NodeStatus { return $this->status; } + public function getStatusAsString(): string + { + return $this->status->name; + } + public function isLocked(): bool { return $this->locked; @@ -108,22 +114,22 @@ public function isLocked(): bool public function isPublished(): bool { - return Node::PUBLISHED === $this->status; + return $this->status->isPublished(); } public function isPending(): bool { - return Node::PENDING === $this->status; + return $this->status->isPending(); } public function isDraft(): bool { - return Node::DRAFT === $this->status; + return $this->status->isDraft(); } public function isDeleted(): bool { - return Node::DELETED === $this->status; + return $this->status->isDeleted(); } public function getNodeType(): NodeTypeInterface diff --git a/lib/RoadizCoreBundle/src/Node/NodeDuplicator.php b/lib/RoadizCoreBundle/src/Node/NodeDuplicator.php index 2ff12929..450f141b 100644 --- a/lib/RoadizCoreBundle/src/Node/NodeDuplicator.php +++ b/lib/RoadizCoreBundle/src/Node/NodeDuplicator.php @@ -10,6 +10,7 @@ use RZ\Roadiz\CoreBundle\Entity\NodesSources; use RZ\Roadiz\CoreBundle\Entity\NodesSourcesDocuments; use RZ\Roadiz\CoreBundle\Entity\NodesToNodes; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use Symfony\Component\DependencyInjection\Attribute\Exclude; /** @@ -49,7 +50,7 @@ public function duplicate(): Node $node->setParent($parent); } // Demote cloned node to draft - $node->setStatus(Node::DRAFT); + $node->setStatus(NodeStatus::DRAFT); $node = $this->doDuplicate($node); $this->objectManager->flush(); diff --git a/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php b/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php index 17c33f9f..e520b814 100644 --- a/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php +++ b/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php @@ -17,6 +17,7 @@ use RZ\Roadiz\CoreBundle\Doctrine\ORM\SimpleQueryBuilder; use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodesSources; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Exception\SolrServerNotAvailableException; use RZ\Roadiz\CoreBundle\Logger\Entity\Log; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; @@ -197,7 +198,7 @@ public function alterQueryBuilderWithAuthorizationChecker( if (!$this->hasJoinedNode($qb, $prefix)) { $qb->innerJoin($prefix.'.node', static::NODE_ALIAS); } - $qb->andWhere($qb->expr()->lte(static::NODE_ALIAS.'.status', Node::PUBLISHED)); + $qb->andWhere($qb->expr()->lte(static::NODE_ALIAS.'.status', ':node_status')); } else { /* * Forbid unpublished node for anonymous and not backend users. @@ -205,8 +206,9 @@ public function alterQueryBuilderWithAuthorizationChecker( if (!$this->hasJoinedNode($qb, $prefix)) { $qb->innerJoin($prefix.'.node', static::NODE_ALIAS); } - $qb->andWhere($qb->expr()->eq(static::NODE_ALIAS.'.status', Node::PUBLISHED)); + $qb->andWhere($qb->expr()->eq(static::NODE_ALIAS.'.status', ':node_status')); } + $qb->setParameter('node_status', NodeStatus::PUBLISHED); return $qb; } @@ -410,10 +412,10 @@ public function findBySearchQuery(string $query, int $limit = 25): array $this->nodeSourceSearchHandler->boostByUpdateDate(); $arguments = []; if ($this->isDisplayingNotPublishedNodes()) { - $arguments['status'] = ['<=', Node::PUBLISHED]; + $arguments['status'] = ['<=', NodeStatus::PUBLISHED]; } if ($this->isDisplayingAllNodesStatuses()) { - $arguments['status'] = ['<=', Node::DELETED]; + $arguments['status'] = ['<=', NodeStatus::DELETED]; } if ($limit > 0) { diff --git a/lib/RoadizCoreBundle/src/Repository/StatusAwareRepository.php b/lib/RoadizCoreBundle/src/Repository/StatusAwareRepository.php index aa96a429..252b4773 100644 --- a/lib/RoadizCoreBundle/src/Repository/StatusAwareRepository.php +++ b/lib/RoadizCoreBundle/src/Repository/StatusAwareRepository.php @@ -6,7 +6,7 @@ use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; -use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -83,10 +83,11 @@ public function alterQueryBuilderWithAuthorizationChecker( * and context. */ if (true === $this->isDisplayingNotPublishedNodes() || $this->previewResolver->isPreview()) { - $qb->andWhere($qb->expr()->lte($prefix.'.status', Node::PUBLISHED)); + $qb->andWhere($qb->expr()->lte($prefix.'.status', ':status')); } else { - $qb->andWhere($qb->expr()->eq($prefix.'.status', Node::PUBLISHED)); + $qb->andWhere($qb->expr()->eq($prefix.'.status', ':status')); } + $qb->setParameter('status', NodeStatus::PUBLISHED); return $qb; } diff --git a/lib/RoadizCoreBundle/src/SearchEngine/NodeSourceSearchHandler.php b/lib/RoadizCoreBundle/src/SearchEngine/NodeSourceSearchHandler.php index f2cf19ab..e3486156 100644 --- a/lib/RoadizCoreBundle/src/SearchEngine/NodeSourceSearchHandler.php +++ b/lib/RoadizCoreBundle/src/SearchEngine/NodeSourceSearchHandler.php @@ -9,6 +9,7 @@ use RZ\Roadiz\Core\AbstractEntities\TranslationInterface; use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\Tag; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\SearchEngine\Event\NodeSourceSearchQueryEvent; class NodeSourceSearchHandler extends AbstractSearchHandler implements NodeSourceSearchHandlerInterface @@ -198,7 +199,7 @@ protected function argFqProcess(array &$args): array unset($args['node.status']); $args['fq'][] = $tmp; } else { - $args['fq'][] = 'node_status_i:'.(string) Node::PUBLISHED; + $args['fq'][] = 'node_status_i:'.(string) NodeStatus::PUBLISHED->value; } /* diff --git a/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultNodesSourcesIndexingSubscriber.php b/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultNodesSourcesIndexingSubscriber.php index 7c7bedfd..e68de05d 100644 --- a/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultNodesSourcesIndexingSubscriber.php +++ b/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultNodesSourcesIndexingSubscriber.php @@ -52,7 +52,7 @@ public function onIndexing(NodesSourcesIndexingEvent $event): void $assoc['node_type_s'] = $nodeSource->getNodeTypeName(); $assoc['node_name_s'] = $node->getNodeName(); $assoc['slug_s'] = $node->getNodeName(); - $assoc['node_status_i'] = $node->getStatus(); + $assoc['node_status_i'] = $node->getStatus()->value; $assoc['node_visible_b'] = $node->isVisible(); $assoc['node_reachable_b'] = $nodeSource->isReachable(); $assoc['created_at_dt'] = $this->formatDateTimeToUTC($node->getCreatedAt()); diff --git a/lib/RoadizCoreBundle/src/Workflow/NodeWorkflow.php b/lib/RoadizCoreBundle/src/Workflow/NodeWorkflow.php index 52352802..e88c50fa 100644 --- a/lib/RoadizCoreBundle/src/Workflow/NodeWorkflow.php +++ b/lib/RoadizCoreBundle/src/Workflow/NodeWorkflow.php @@ -4,7 +4,7 @@ namespace RZ\Roadiz\CoreBundle\Workflow; -use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use Symfony\Component\Workflow\DefinitionBuilder; use Symfony\Component\Workflow\MarkingStore\MethodMarkingStore; use Symfony\Component\Workflow\Transition; @@ -17,36 +17,31 @@ public function __construct(EventDispatcherInterface $dispatcher) { $definitionBuilder = new DefinitionBuilder(); $definition = $definitionBuilder - ->setInitialPlaces($this->toPlace(Node::DRAFT)) + ->setInitialPlaces(NodeStatus::DRAFT->name) ->addPlaces([ - $this->toPlace(Node::DRAFT), - $this->toPlace(Node::PENDING), - $this->toPlace(Node::PUBLISHED), - $this->toPlace(Node::ARCHIVED), - $this->toPlace(Node::DELETED), + NodeStatus::DRAFT->name, + NodeStatus::PENDING->name, + NodeStatus::PUBLISHED->name, + NodeStatus::ARCHIVED->name, + NodeStatus::DELETED->name, ]) - ->addTransition(new Transition('review', $this->toPlace(Node::DRAFT), $this->toPlace(Node::PENDING))) - ->addTransition(new Transition('review', $this->toPlace(Node::PUBLISHED), $this->toPlace(Node::PENDING))) - ->addTransition(new Transition('reject', $this->toPlace(Node::PENDING), $this->toPlace(Node::DRAFT))) - ->addTransition(new Transition('reject', $this->toPlace(Node::PUBLISHED), $this->toPlace(Node::DRAFT))) - ->addTransition(new Transition('publish', $this->toPlace(Node::DRAFT), $this->toPlace(Node::PUBLISHED))) - ->addTransition(new Transition('publish', $this->toPlace(Node::PENDING), $this->toPlace(Node::PUBLISHED))) - ->addTransition(new Transition('publish', $this->toPlace(Node::PUBLISHED), $this->toPlace(Node::PUBLISHED))) - ->addTransition(new Transition('archive', $this->toPlace(Node::PUBLISHED), $this->toPlace(Node::ARCHIVED))) - ->addTransition(new Transition('unarchive', $this->toPlace(Node::ARCHIVED), $this->toPlace(Node::DRAFT))) - ->addTransition(new Transition('delete', $this->toPlace(Node::DRAFT), $this->toPlace(Node::DELETED))) - ->addTransition(new Transition('delete', $this->toPlace(Node::PENDING), $this->toPlace(Node::DELETED))) - ->addTransition(new Transition('delete', $this->toPlace(Node::PUBLISHED), $this->toPlace(Node::DELETED))) - ->addTransition(new Transition('delete', $this->toPlace(Node::ARCHIVED), $this->toPlace(Node::DELETED))) - ->addTransition(new Transition('undelete', $this->toPlace(Node::DELETED), $this->toPlace(Node::DRAFT))) + ->addTransition(new Transition('review', NodeStatus::DRAFT->name, NodeStatus::PENDING->name)) + ->addTransition(new Transition('review', NodeStatus::PUBLISHED->name, NodeStatus::PENDING->name)) + ->addTransition(new Transition('reject', NodeStatus::PENDING->name, NodeStatus::DRAFT->name)) + ->addTransition(new Transition('reject', NodeStatus::PUBLISHED->name, NodeStatus::DRAFT->name)) + ->addTransition(new Transition('publish', NodeStatus::DRAFT->name, NodeStatus::PUBLISHED->name)) + ->addTransition(new Transition('publish', NodeStatus::PENDING->name, NodeStatus::PUBLISHED->name)) + ->addTransition(new Transition('publish', NodeStatus::PUBLISHED->name, NodeStatus::PUBLISHED->name)) + ->addTransition(new Transition('archive', NodeStatus::PUBLISHED->name, NodeStatus::ARCHIVED->name)) + ->addTransition(new Transition('unarchive', NodeStatus::ARCHIVED->name, NodeStatus::DRAFT->name)) + ->addTransition(new Transition('delete', NodeStatus::DRAFT->name, NodeStatus::DELETED->name)) + ->addTransition(new Transition('delete', NodeStatus::PENDING->name, NodeStatus::DELETED->name)) + ->addTransition(new Transition('delete', NodeStatus::PUBLISHED->name, NodeStatus::DELETED->name)) + ->addTransition(new Transition('delete', NodeStatus::ARCHIVED->name, NodeStatus::DELETED->name)) + ->addTransition(new Transition('undelete', NodeStatus::DELETED->name, NodeStatus::DRAFT->name)) ->build() ; - $markingStore = new MethodMarkingStore(true, 'status'); + $markingStore = new MethodMarkingStore(true, 'statusAsString'); parent::__construct($definition, $markingStore, $dispatcher, 'node'); } - - protected function toPlace(int $legacyPlace): string - { - return (string) $legacyPlace; - } } diff --git a/lib/RoadizRozierBundle/src/TwigExtension/RozierExtension.php b/lib/RoadizRozierBundle/src/TwigExtension/RozierExtension.php index a58db20a..07c26900 100644 --- a/lib/RoadizRozierBundle/src/TwigExtension/RozierExtension.php +++ b/lib/RoadizRozierBundle/src/TwigExtension/RozierExtension.php @@ -4,7 +4,7 @@ namespace RZ\Roadiz\RozierBundle\TwigExtension; -use RZ\Roadiz\CoreBundle\Entity\Node; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use Themes\Rozier\RozierServiceRegistry; use Twig\Extension\AbstractExtension; use Twig\Extension\GlobalsInterface; @@ -20,13 +20,7 @@ public function getGlobals(): array { return [ 'rozier' => $this->rozierServiceRegistry, - 'nodeStatuses' => [ - Node::getStatusLabel(Node::DRAFT) => Node::DRAFT, - Node::getStatusLabel(Node::PENDING) => Node::PENDING, - Node::getStatusLabel(Node::PUBLISHED) => Node::PUBLISHED, - Node::getStatusLabel(Node::ARCHIVED) => Node::ARCHIVED, - Node::getStatusLabel(Node::DELETED) => Node::DELETED, - ], + 'nodeStatuses' => NodeStatus::allLabelsAndValues(), ]; } } diff --git a/lib/Rozier/src/AjaxControllers/AjaxNodesController.php b/lib/Rozier/src/AjaxControllers/AjaxNodesController.php index a6dd9873..80c4138c 100644 --- a/lib/Rozier/src/AjaxControllers/AjaxNodesController.php +++ b/lib/Rozier/src/AjaxControllers/AjaxNodesController.php @@ -312,7 +312,7 @@ protected function changeNodeStatus(Node $node, string $transition): JsonRespons $this->em()->flush(); $msg = $this->getTranslator()->trans('node.%name%.status_changed_to.%status%', [ '%name%' => $node->getNodeName(), - '%status%' => $this->getTranslator()->trans(Node::getStatusLabel($node->getStatus())), + '%status%' => $node->getStatus()->trans($this->getTranslator()), ]); $this->publishConfirmMessage($request, $msg, $node->getNodeSources()->first() ?: $node); diff --git a/lib/Rozier/src/AjaxControllers/AjaxNodesExplorerController.php b/lib/Rozier/src/AjaxControllers/AjaxNodesExplorerController.php index 5387df99..8e7412a6 100644 --- a/lib/Rozier/src/AjaxControllers/AjaxNodesExplorerController.php +++ b/lib/Rozier/src/AjaxControllers/AjaxNodesExplorerController.php @@ -10,6 +10,7 @@ use RZ\Roadiz\CoreBundle\Entity\NodesSources; use RZ\Roadiz\CoreBundle\Entity\Tag; use RZ\Roadiz\CoreBundle\EntityApi\NodeTypeApi; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Explorer\AbstractExplorerItem; use RZ\Roadiz\CoreBundle\Explorer\ExplorerItemFactoryInterface; use RZ\Roadiz\CoreBundle\SearchEngine\ClientRegistry; @@ -72,7 +73,7 @@ public function indexAction(Request $request): Response protected function parseFilterFromRequest(Request $request): array { $arrayFilter = [ - 'status' => ['<=', Node::ARCHIVED], + 'status' => ['<=', NodeStatus::ARCHIVED], ]; if ($request->query->has('tagId') && $request->get('tagId') > 0) { diff --git a/lib/Rozier/src/Controllers/Nodes/NodesController.php b/lib/Rozier/src/Controllers/Nodes/NodesController.php index ce948f18..a502b9ed 100644 --- a/lib/Rozier/src/Controllers/Nodes/NodesController.php +++ b/lib/Rozier/src/Controllers/Nodes/NodesController.php @@ -10,6 +10,7 @@ use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\Entity\User; use RZ\Roadiz\CoreBundle\EntityHandler\NodeHandler; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Event\Node\NodeCreatedEvent; use RZ\Roadiz\CoreBundle\Event\Node\NodeDeletedEvent; use RZ\Roadiz\CoreBundle\Event\Node\NodePathChangedEvent; @@ -78,25 +79,25 @@ public function indexAction(Request $request, ?string $filter = null): Response case 'draft': $this->assignation['mainFilter'] = $filter; $arrayFilter = [ - 'status' => Node::DRAFT, + 'status' => NodeStatus::DRAFT, ]; break; case 'pending': $this->assignation['mainFilter'] = $filter; $arrayFilter = [ - 'status' => Node::PENDING, + 'status' => NodeStatus::PENDING, ]; break; case 'archived': $this->assignation['mainFilter'] = $filter; $arrayFilter = [ - 'status' => Node::ARCHIVED, + 'status' => NodeStatus::ARCHIVED, ]; break; case 'deleted': $this->assignation['mainFilter'] = $filter; $arrayFilter = [ - 'status' => Node::DELETED, + 'status' => NodeStatus::DELETED, ]; break; default: @@ -526,7 +527,7 @@ public function emptyTrashAction(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $criteria = ['status' => Node::DELETED]; + $criteria = ['status' => NodeStatus::DELETED]; /** @var Node|null $chroot */ $chroot = $this->nodeChrootResolver->getChroot($this->getUser()); if (null !== $chroot) { diff --git a/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php b/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php index 61656cdc..79f2550e 100644 --- a/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php +++ b/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php @@ -9,6 +9,7 @@ use RZ\Roadiz\CoreBundle\Entity\Tag; use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\EntityHandler\NodeHandler; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Security\Authorization\Chroot\NodeChrootResolver; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\Form\ClickableInterface; @@ -500,10 +501,10 @@ private function buildBulkStatusForm( 'label' => false, 'data' => $status, 'choices' => [ - Node::getStatusLabel(Node::DRAFT) => 'reject', - Node::getStatusLabel(Node::PENDING) => 'review', - Node::getStatusLabel(Node::PUBLISHED) => 'publish', - Node::getStatusLabel(Node::ARCHIVED) => 'archive', + NodeStatus::DRAFT->getLabel() => 'reject', + NodeStatus::PENDING->getLabel() => 'review', + NodeStatus::PUBLISHED->getLabel() => 'publish', + NodeStatus::ARCHIVED->getLabel() => 'archive', ], 'constraints' => [ new NotNull(), diff --git a/lib/Rozier/src/Forms/Node/AddNodeType.php b/lib/Rozier/src/Forms/Node/AddNodeType.php index 886aacd0..0429e855 100644 --- a/lib/Rozier/src/Forms/Node/AddNodeType.php +++ b/lib/Rozier/src/Forms/Node/AddNodeType.php @@ -7,11 +7,11 @@ use Doctrine\Persistence\ManagerRegistry; use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Form\DataTransformer\NodeTypeTransformer; +use RZ\Roadiz\CoreBundle\Form\NodeStatesType; use RZ\Roadiz\CoreBundle\Form\NodeTypesType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Event\SubmitEvent; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvents; @@ -74,15 +74,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'label' => 'hiding-children', 'required' => false, ]) - ->add('status', ChoiceType::class, [ + ->add('status', NodeStatesType::class, [ 'label' => 'node.status', 'required' => true, - 'choices' => [ - Node::getStatusLabel(Node::DRAFT) => Node::DRAFT, - Node::getStatusLabel(Node::PENDING) => Node::PENDING, - Node::getStatusLabel(Node::PUBLISHED) => Node::PUBLISHED, - Node::getStatusLabel(Node::ARCHIVED) => Node::ARCHIVED, - ], ]); $builder->addEventListener(FormEvents::SUBMIT, function (SubmitEvent $event) { diff --git a/lib/Rozier/src/Forms/NodeTreeType.php b/lib/Rozier/src/Forms/NodeTreeType.php index 71bded78..be729211 100644 --- a/lib/Rozier/src/Forms/NodeTreeType.php +++ b/lib/Rozier/src/Forms/NodeTreeType.php @@ -10,6 +10,7 @@ use RZ\Roadiz\CoreBundle\Entity\NodesSources; use RZ\Roadiz\CoreBundle\Entity\NodeType; use RZ\Roadiz\CoreBundle\Entity\NodeTypeField; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormInterface; @@ -89,13 +90,7 @@ public function finishView(FormView $view, FormInterface $form, array $options): } $view->vars['nodeTree'] = $nodeTree; - $view->vars['nodeStatuses'] = [ - Node::getStatusLabel(Node::DRAFT) => Node::DRAFT, - Node::getStatusLabel(Node::PENDING) => Node::PENDING, - Node::getStatusLabel(Node::PUBLISHED) => Node::PUBLISHED, - Node::getStatusLabel(Node::ARCHIVED) => Node::ARCHIVED, - Node::getStatusLabel(Node::DELETED) => Node::DELETED, - ]; + $view->vars['nodeStatuses'] = NodeStatus::allLabelsAndValues(); } public function getParent(): ?string diff --git a/src/DataFixtures/ArticleFixtures.php b/src/DataFixtures/ArticleFixtures.php index ffbfde5c..b6679932 100644 --- a/src/DataFixtures/ArticleFixtures.php +++ b/src/DataFixtures/ArticleFixtures.php @@ -7,9 +7,9 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; -use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodeType; use RZ\Roadiz\CoreBundle\Entity\Translation; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Node\UniqueNodeGenerator; class ArticleFixtures extends Fixture implements DependentFixtureInterface @@ -35,7 +35,7 @@ public function load(ObjectManager $manager): void flush: false, ); $articleContainer->setTitle('Articles container'); - $articleContainer->getNode()->setStatus(Node::PUBLISHED); + $articleContainer->getNode()->setStatus(NodeStatus::PUBLISHED); $articleContainer->setPublishedAt(new \DateTime()); $manager->flush(); @@ -46,7 +46,7 @@ public function load(ObjectManager $manager): void parent: $articleContainer->getNode(), flush: false, ); - $article->getNode()->setStatus(Node::PUBLISHED); + $article->getNode()->setStatus(NodeStatus::PUBLISHED); $article->setPublishedAt(new \DateTime()); } diff --git a/src/DataFixtures/OfferFixtures.php b/src/DataFixtures/OfferFixtures.php index 07dd484b..2cfb12cc 100644 --- a/src/DataFixtures/OfferFixtures.php +++ b/src/DataFixtures/OfferFixtures.php @@ -8,9 +8,9 @@ use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; -use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\NodeType; use RZ\Roadiz\CoreBundle\Entity\Translation; +use RZ\Roadiz\CoreBundle\Enum\NodeStatus; use RZ\Roadiz\CoreBundle\Node\UniqueNodeGenerator; class OfferFixtures extends Fixture implements DependentFixtureInterface @@ -38,7 +38,7 @@ public function load(ObjectManager $manager): void flush: false, ); $offerContainer->setTitle('Offers container'); - $offerContainer->getNode()->setStatus(Node::PUBLISHED); + $offerContainer->getNode()->setStatus(NodeStatus::PUBLISHED); $offerContainer->setPublishedAt(new \DateTime()); for ($i = 0; $i < 50; ++$i) { @@ -51,7 +51,7 @@ public function load(ObjectManager $manager): void parent: $offerContainer->getNode(), flush: false, ); - $offer->getNode()->setStatus(Node::PUBLISHED); + $offer->getNode()->setStatus(NodeStatus::PUBLISHED); $offer->setPrice(mt_rand(10, 10000)); $offer->setVat(0.2); $offer->setPublishedAt(new \DateTime());