Skip to content
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eab364f
WIP: allergy warning; fixes on payment plans
veelkoov Aug 12, 2025
53ea0cd
Fixed PHPStan issues
veelkoov Aug 14, 2025
eb210a7
Fixed tests
veelkoov Aug 15, 2025
f82d63a
Removed unused
veelkoov Aug 15, 2025
701cfdd
Merge branch 'develop' into feature/allergy-warning-and-filters-impro…
veelkoov Aug 16, 2025
d493127
Upgrade 3rd party
veelkoov Aug 16, 2025
8162b4d
Merge branch 'develop' into feature/allergy-warning-and-filters-impro…
veelkoov Aug 16, 2025
260fbeb
Migrate ages
veelkoov Aug 16, 2025
8cc8840
Improved/refactored Choices and valid choices filter/test
veelkoov Aug 17, 2025
f6015cb
Fixes
veelkoov Aug 17, 2025
aedbca7
Small refac
veelkoov Aug 17, 2025
fad09bc
Improved namespace name
veelkoov Aug 17, 2025
28caa4c
Some refactorrrrrrr
veelkoov Aug 17, 2025
64e8404
Debris upgrade
veelkoov Aug 31, 2025
4bf0eda
Merge branch 'develop' into feature/allergy-warning-and-filters-impro…
veelkoov Aug 31, 2025
9e179be
Merge branch 'develop' into feature/allergy-warning-and-filters-impro…
veelkoov Aug 31, 2025
144a393
Tiny refactor
veelkoov Sep 14, 2025
e45de2b
WIP filter
veelkoov Sep 14, 2025
b120659
Merge branch 'develop' into feature/allergy-warning-and-filters-impro…
veelkoov Sep 21, 2025
b27f0df
Merge branch 'develop' into feature/allergy-warning-and-filters-impro…
veelkoov Oct 4, 2025
b4c3ea2
Fix Extended test; plans as plain text, not list
veelkoov Oct 5, 2025
2ecc1e2
Fix desc
veelkoov Oct 5, 2025
4c9a7d3
Display allergy warnings
veelkoov Oct 12, 2025
6257fd9
Improve comment
veelkoov Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions symfony/config/fuzzrake/payments.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
parameters:
noPayPlans:
regex_prefix: "^"
regex_suffix: "$"
replacements: [] # grep-payment-plans-none
# FIXME: https://github.com/veelkoov/fuzzrake/issues/305
# "None/100% up ?front": "None"
# '"None, 100% upfront"': "None"
# "None": "None"
# "No payment plans/100% upfront": "None"
# "100% upfront every part": "None"
# '100% Up ?Front\.?': "None"
# "1 complete payment": "None"

currencies:
regex_prefix: '(?<=^|\n)'
regex_suffix: '(?=\n|$)'
Expand Down
2 changes: 1 addition & 1 deletion symfony/global/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function iter_sortl(iterable $iterable): array
*
* @param array<V> $array
*
* @return V|null
* @return ($array is non-empty-array ? V : null)
*/
function array_first(array $array): mixed
{
Expand Down
56 changes: 56 additions & 0 deletions symfony/migrations/Version20250816154014.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

final class Version20250816154014 extends AbstractMigration
{
#[Override]
public function getDescription(): string
{
return 'Add allergy warning fields, refactor payment plans into boolean + text info. Migrate ages from creator_values to creators table.';
}

public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
CREATE TEMPORARY TABLE __temp__creators AS SELECT id, creator_id, name, formerly, intro, since, country, state, city, payment_plans, species_does, species_doesnt, notes, contact_allowed, inactive_reason, production_models_comment, styles_comment, order_types_comment, features_comment, payment_methods, currencies_accepted, species_comment FROM creators
SQL);
$this->addSql('DROP TABLE creators');
$this->addSql(<<<'SQL'
CREATE TABLE creators (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, creator_id CLOB NOT NULL, name CLOB NOT NULL, formerly CLOB NOT NULL, intro CLOB NOT NULL, since CLOB NOT NULL, country CLOB NOT NULL, state CLOB NOT NULL, city CLOB NOT NULL, allergy_warning_info CLOB NOT NULL, species_does CLOB NOT NULL, species_doesnt CLOB NOT NULL, notes CLOB NOT NULL, contact_allowed CLOB DEFAULT NULL, inactive_reason CLOB NOT NULL, production_models_comment CLOB NOT NULL, styles_comment CLOB NOT NULL, order_types_comment CLOB NOT NULL, features_comment CLOB NOT NULL, payment_methods CLOB NOT NULL, currencies_accepted CLOB NOT NULL, species_comment CLOB NOT NULL, ages CLOB DEFAULT NULL, has_allergy_warning BOOLEAN DEFAULT NULL, offers_payment_plans BOOLEAN DEFAULT NULL, payment_plans_info CLOB NOT NULL)
SQL);
$this->addSql(<<<'SQL'
INSERT INTO creators (id, creator_id, name, formerly, intro, since, country, state, city, allergy_warning_info, species_does, species_doesnt, notes, contact_allowed, inactive_reason, production_models_comment, styles_comment, order_types_comment, features_comment, payment_methods, currencies_accepted, species_comment, payment_plans_info) SELECT id, creator_id, name, formerly, intro, since, country, state, city, '', species_does, species_doesnt, notes, contact_allowed, inactive_reason, production_models_comment, styles_comment, order_types_comment, features_comment, payment_methods, currencies_accepted, species_comment, payment_plans FROM __temp__creators
SQL);
$this->addSql(<<<'SQL'
DROP TABLE __temp__creators
SQL);
$this->addSql(<<<'SQL'
UPDATE creators SET offers_payment_plans = true WHERE payment_plans_info <> ''
SQL);
$this->addSql(<<<'SQL'
UPDATE creators SET offers_payment_plans = false WHERE payment_plans_info = 'None'
SQL);
$this->addSql(<<<'SQL'
UPDATE creators SET payment_plans_info = '' WHERE payment_plans_info = 'None'
SQL);
$this->addSql(<<<'SQL'
UPDATE creators SET ages = (SELECT value FROM creators_values AS cv WHERE cv.creator_id = creators.id AND cv.field_name = 'AGES')
SQL);
$this->addSql(<<<'SQL'
DELETE FROM creators_values WHERE field_name = 'AGES'
SQL);
}

#[Override]
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException(); // Restore the backup.
}
}
4 changes: 2 additions & 2 deletions symfony/src/Controller/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace App\Controller;

use App\Controller\Traits\CreatorByCreatorIdTrait;
use App\Filtering\DataRequests\FilteredDataProvider;
use App\Filtering\DataRequests\RequestParser;
use App\Filtering\FiltersData\FiltersService;
use App\Filtering\RequestsHandling\FilteredDataProvider;
use App\Filtering\RequestsHandling\RequestParser;
use App\Repository\CreatorRepository;
use App\Service\DataService;
use App\Utils\Creator\CreatorId;
Expand Down
13 changes: 11 additions & 2 deletions symfony/src/Data/Definitions/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,17 @@ enum Field: string // Backing by strings gives free ::from() and ::tryFrom()
#[Props('otherFeatures', type: Type::STR_LIST, validationRegex: V::LIST_VALIDATION)]
case OTHER_FEATURES = 'OTHER_FEATURES';

#[Props('paymentPlans', type: Type::STR_LIST)]
case PAYMENT_PLANS = 'PAYMENT_PLANS';
#[Props('hasAllergyWarning', type: Type::BOOLEAN)]
case HAS_ALLERGY_WARNING = 'HAS_ALLERGY_WARNING';

#[Props('allergyWarningInfo', type: Type::STRING)]
case ALLERGY_WARNING_INFO = 'ALLERGY_WARNING_INFO';

#[Props('offersPaymentPlans', type: Type::BOOLEAN)]
case OFFERS_PAYMENT_PLANS = 'OFFERS_PAYMENT_PLANS';

#[Props('paymentPlansInfo', type: Type::STR_LIST)]
case PAYMENT_PLANS_INFO = 'PAYMENT_PLANS_INFO';

#[Props('paymentMethods', type: Type::STR_LIST, validationRegex: V::PAY_METHODS)]
case PAYMENT_METHODS = 'PAYMENT_METHODS';
Expand Down
3 changes: 0 additions & 3 deletions symfony/src/Data/Fixer/Fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use App\Data\Fixer\StrList\LanguagesFixer;
use App\Data\Fixer\StrList\NoopStrListFixer;
use App\Data\Fixer\StrList\PayMethodFixer;
use App\Data\Fixer\StrList\PayPlanFixer;
use App\Data\Fixer\StrList\SpeciesListFixer;
use App\Data\Fixer\StrList\UrlListStringFixer;
use App\Utils\Creator\SmartAccessDecorator as Creator;
Expand All @@ -38,7 +37,6 @@ public function __construct(
private readonly NoopStringFixer $noopFixer,
private readonly NoopStrListFixer $noopListFixer,
private readonly StateFixerConfigurable $stateFixer,
private readonly PayPlanFixer $payPlanFixer,
private readonly CurrencyFixer $currencyFixer,
private readonly PayMethodFixer $payMethodFixer,
) {
Expand Down Expand Up @@ -97,7 +95,6 @@ private function getStrListFixer(F $field): StrListFixerInterface
F::URL_COMMISSIONS, F::URL_PRICES, F::URL_PHOTOS => $this->urlListFixer,

F::LANGUAGES => $this->languagesFixer,
F::PAYMENT_PLANS => $this->payPlanFixer,
F::PAYMENT_METHODS => $this->payMethodFixer,
F::CURRENCIES_ACCEPTED => $this->currencyFixer,

Expand Down
37 changes: 0 additions & 37 deletions symfony/src/Data/Fixer/StrList/PayPlanFixer.php

This file was deleted.

71 changes: 66 additions & 5 deletions symfony/src/Entity/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Entity;

use App\Data\Definitions\Ages;
use App\Data\Definitions\ContactPermit;
use App\Repository\CreatorRepository;
use App\Utils\Creator\SmartAccessDecorator;
Expand Down Expand Up @@ -54,6 +55,9 @@ class Creator implements Stringable
#[ORM\Column(type: Types::TEXT)]
private string $city = '';

#[ORM\Column(type: Types::TEXT, nullable: true, enumType: Ages::class)]
private ?Ages $ages = null;

#[ORM\Column(type: Types::TEXT)]
private string $productionModelsComment = '';

Expand All @@ -66,8 +70,17 @@ class Creator implements Stringable
#[ORM\Column(type: Types::TEXT)]
private string $featuresComment = '';

#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $hasAllergyWarning = null;

#[ORM\Column(type: Types::TEXT)]
private string $allergyWarningInfo = '';

#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $offersPaymentPlans = null;

#[ORM\Column(type: Types::TEXT)]
private string $paymentPlans = '';
private string $paymentPlansInfo = '';

#[ORM\Column(type: Types::TEXT)]
private string $paymentMethods = '';
Expand Down Expand Up @@ -295,6 +308,18 @@ public function setCity(string $city): self
return $this;
}

public function getAges(): ?Ages
{
return $this->ages;
}

public function setAges(?Ages $ages): self
{
$this->ages = $ages;

return $this;
}

public function getProductionModelsComment(): string
{
return $this->productionModelsComment;
Expand Down Expand Up @@ -343,14 +368,50 @@ public function setFeaturesComment(string $featuresComment): self
return $this;
}

public function getPaymentPlans(): string
public function getHasAllergyWarning(): ?bool
{
return $this->hasAllergyWarning;
}

public function setHasAllergyWarning(?bool $hasAllergyWarning): self
{
$this->hasAllergyWarning = $hasAllergyWarning;

return $this;
}

public function getAllergyWarningInfo(): string
{
return $this->allergyWarningInfo;
}

public function setAllergyWarningInfo(string $allergyWarningInfo): self
{
$this->allergyWarningInfo = $allergyWarningInfo;

return $this;
}

public function getOffersPaymentPlans(): ?bool
{
return $this->offersPaymentPlans;
}

public function setOffersPaymentPlans(?bool $offersPaymentPlans): self
{
$this->offersPaymentPlans = $offersPaymentPlans;

return $this;
}

public function getPaymentPlansInfo(): string
{
return $this->paymentPlans;
return $this->paymentPlansInfo;
}

public function setPaymentPlans(string $paymentPlans): self
public function setPaymentPlansInfo(string $paymentPlansInfo): self
{
$this->paymentPlans = $paymentPlans;
$this->paymentPlansInfo = $paymentPlansInfo;

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Filtering\DataRequests;
namespace App\Filtering;

use App\Utils\Traits\UtilityClass;

Expand All @@ -18,9 +18,7 @@ final class Consts
public const string FILTER_VALUE_INCLUDE_INACTIVE = '.';

// FIXME: All below around payment plans https://github.com/veelkoov/fuzzrake/issues/305
public const string DATA_PAYPLANS_NONE = 'None'; // grep-payment-plans-none

public const string FILTER_LABEL_PAYPLANS_NONE = 'Not supported';
public const string FILTER_LABEL_PAYPLANS_NONE = 'Not supported'; // FIXME: How about "Not offered"?
public const string FILTER_LABEL_PAYPLANS_SUPPORTED = 'Supported';

public const string FILTER_VALUE_PAYPLANS_SUPPORTED = self::FILTER_LABEL_PAYPLANS_SUPPORTED;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace App\Filtering\FiltersData\Builder;

use App\Filtering\DataRequests\Consts;
use App\Filtering\Consts;
use App\Utils\Traits\UtilityClass;
use InvalidArgumentException;

Expand Down
1 change: 1 addition & 0 deletions symfony/src/Filtering/FiltersData/FiltersData.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct(
public FilterData $countries,
public FilterData $states,
public FilterData $species,
public FilterData $ages,
public FilterData $inactive,
) {
}
Expand Down
Loading