Merge pull request #237 from goteo/feat/post-project-with-territory
feat: add territory to project creation
This commit is contained in:
@@ -6,6 +6,7 @@ use ApiPlatform\Metadata as API;
|
||||
use App\ApiResource\CategoryApiResource;
|
||||
use App\Entity\Project\ProjectCalendar;
|
||||
use App\Entity\Project\ProjectStatus;
|
||||
use App\Entity\Territory;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class ProjectCreationDto
|
||||
@@ -17,6 +18,7 @@ class ProjectCreationDto
|
||||
*/
|
||||
#[Assert\NotBlank()]
|
||||
#[Assert\Regex('/[a-zA-Z]{1,}/')]
|
||||
#[Assert\Length(min: 3)]
|
||||
public string $title;
|
||||
|
||||
/**
|
||||
@@ -25,12 +27,6 @@ class ProjectCreationDto
|
||||
#[Assert\NotBlank()]
|
||||
public string $subtitle;
|
||||
|
||||
/**
|
||||
* URL to an image resource to be displayed as header.
|
||||
*/
|
||||
#[Assert\Url()]
|
||||
public string $cover;
|
||||
|
||||
/**
|
||||
* List of Categories.
|
||||
*
|
||||
@@ -41,6 +37,12 @@ class ProjectCreationDto
|
||||
#[API\ApiProperty(writableLink: false, openapiContext: self::CATEGORIES_OPENAPI_CONTEXT)]
|
||||
public array $categories;
|
||||
|
||||
/**
|
||||
* ISO 3166 data about the Project's territory of interest.
|
||||
*/
|
||||
#[Assert\Valid()]
|
||||
public Territory $territory;
|
||||
|
||||
/**
|
||||
* Deadlines and important Project dates.
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ class Territory
|
||||
* ISO 3166-1 alpha-2 two-letter country code.\
|
||||
* e.g: ES (Spain).
|
||||
*/
|
||||
#[Assert\NotBlank()]
|
||||
#[Assert\Country(alpha3: false)]
|
||||
#[ORM\Column(type: Types::STRING, nullable: true)]
|
||||
public readonly ?string $country;
|
||||
|
||||
Reference in New Issue
Block a user