current init

This commit is contained in:
Marek
2026-03-30 15:42:44 +02:00
parent c5229e48ed
commit 2f96caaa23
366 changed files with 6093 additions and 11029 deletions

View File

@@ -0,0 +1,16 @@
<?php
namespace App\DTO\Request;
use Symfony\Component\Validator\Constraints as Assert;
class CreateCategoryRequest
{
#[Assert\NotBlank]
#[Assert\Length(max: 255)]
public string $name;
#[Assert\NotBlank]
#[Assert\CssColor(formats: Assert\CssColor::HEX_LONG)]
public string $color;
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\DTO\Request;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
class CreateSchemaRequest
{
#[Assert\NotBlank]
#[Assert\Length(max: 255)]
public ?string $name = null;
public ?int $categoryId = null;
public ?string $status = null;
public ?string $taskType = null;
public ?string $deadline = null;
public ?string $startDate = null;
public ?string $endDate = null;
public ?array $weekdays = null;
public ?array $monthDays = null;
public ?array $yearDays = null;
#[Assert\Callback]
public function validate(ExecutionContextInterface $context): void
{
if ($this->taskType !== null && $this->taskType !== 'einzel') {
if ($this->startDate !== null && $this->endDate !== null && $this->endDate < $this->startDate) {
$context->buildViolation('endDate muss >= startDate sein.')
->atPath('endDate')
->addViolation();
}
}
if ($this->taskType === 'woechentlich') {
if (empty($this->weekdays)) {
$context->buildViolation('weekdays darf nicht leer sein.')
->atPath('weekdays')
->addViolation();
}
}
if ($this->taskType === 'monatlich') {
if (empty($this->monthDays)) {
$context->buildViolation('monthDays darf nicht leer sein.')
->atPath('monthDays')
->addViolation();
}
}
if ($this->taskType === 'multi' || $this->taskType === 'jaehrlich') {
if (empty($this->yearDays)) {
$context->buildViolation('yearDays darf nicht leer sein.')
->atPath('yearDays')
->addViolation();
}
}
}
}

View File

@@ -0,0 +1,8 @@
<?php
namespace App\DTO\Request;
class ToggleRequest
{
public ?string $date = null;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\DTO\Request;
use Symfony\Component\Validator\Constraints as Assert;
class UpdateCategoryRequest
{
#[Assert\Length(min: 1, max: 255)]
public ?string $name = null;
#[Assert\CssColor(formats: Assert\CssColor::HEX_LONG)]
public ?string $color = null;
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\DTO\Request;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
class UpdateSchemaRequest
{
#[Assert\NotBlank]
#[Assert\Length(max: 255)]
public ?string $name = null;
public ?int $categoryId = null;
public bool $hasCategoryId = false;
public ?string $status = null;
public ?string $taskType = null;
public ?string $deadline = null;
public ?string $startDate = null;
public ?string $endDate = null;
public ?array $weekdays = null;
public ?array $monthDays = null;
public ?array $yearDays = null;
#[Assert\Callback]
public function validate(ExecutionContextInterface $context): void
{
if ($this->taskType !== null && $this->taskType !== 'einzel') {
if ($this->startDate !== null && $this->endDate !== null && $this->endDate < $this->startDate) {
$context->buildViolation('endDate muss >= startDate sein.')
->atPath('endDate')
->addViolation();
}
}
if ($this->taskType === 'woechentlich') {
if (empty($this->weekdays)) {
$context->buildViolation('weekdays darf nicht leer sein.')
->atPath('weekdays')
->addViolation();
}
}
if ($this->taskType === 'monatlich') {
if (empty($this->monthDays)) {
$context->buildViolation('monthDays darf nicht leer sein.')
->atPath('monthDays')
->addViolation();
}
}
if ($this->taskType === 'multi' || $this->taskType === 'jaehrlich') {
if (empty($this->yearDays)) {
$context->buildViolation('yearDays darf nicht leer sein.')
->atPath('yearDays')
->addViolation();
}
}
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\DTO\Request;
class UpdateTaskRequest
{
public ?string $name = null;
public ?int $categoryId = null;
public ?string $status = null;
public ?string $date = null;
}