* feat: start project reviews entity * feat: add review areas entity * feat: add review comments entity * fix: code styles improvements by php-cs-fixer * feat: expose project review resources in the API * feat: add timestampt to review resources * feat: add SQL migration * fix: update ProjectReview API docs and operations * feat: refactor ProjectsListener to dedicated project status listener * fix: make default review area risk high * feat: add ReviewService for creating default project reviews * fix: renamed timestampt entity traits * fix: update doctrine migration * feat: test for release date to be set greater than today's start * feat: add test for project campaign review * fix: update person and organization patch validations * fix: test if review entity is truly persisted * fix: bad start statuses in project tests * fix: ProjectStatusListener not persisting side effect data * fix: centralize project status change side-effects processing in ProjectService * fix: small review persistence tweaks * feat: allow only concerned users to see and edit review areas * feat: apply validations and security for concerned users to review comments
58 lines
1.9 KiB
PHP
58 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\ApiResource\Project;
|
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
|
use ApiPlatform\Doctrine\Orm\State\Options;
|
|
use ApiPlatform\Metadata as API;
|
|
use App\ApiResource\TimestampedCreationApiResource;
|
|
use App\ApiResource\TimestampedUpdationApiResource;
|
|
use App\ApiResource\User\UserApiResource;
|
|
use App\Entity\Project\Review;
|
|
use App\Entity\Project\ReviewType;
|
|
use App\State\ApiResourceStateProcessor;
|
|
use App\State\ApiResourceStateProvider;
|
|
|
|
/**
|
|
* ProjectReviews are launched as health-checks for Projects.\
|
|
* \
|
|
* The reviews are focused on certain aspects of a Project's lifecycle. The types `campaign` and `financial` reviews
|
|
* are to evaluate the fitness of a Project before being greenlit for campaigning or the legitimacy of their raised funds, respectively.\
|
|
* \
|
|
* ProjectReview resources cannot be manually created, they are created automatically when a Project moves into a "to review" status:
|
|
* - `to_campaign_review`: will launch a related ProjectReview of `campaign` type
|
|
* - `to_financial_review`: will launch a related ProjectReview of `financial` type.
|
|
*/
|
|
#[API\ApiResource(
|
|
shortName: 'ProjectReview',
|
|
stateOptions: new Options(entityClass: Review::class),
|
|
provider: ApiResourceStateProvider::class,
|
|
processor: ApiResourceStateProcessor::class
|
|
)]
|
|
#[API\GetCollection()]
|
|
#[API\Get()]
|
|
#[API\Delete()]
|
|
#[API\Patch()]
|
|
class ReviewApiResource
|
|
{
|
|
use TimestampedCreationApiResource;
|
|
use TimestampedUpdationApiResource;
|
|
|
|
#[API\ApiProperty(identifier: true, writable: false)]
|
|
public int $id;
|
|
|
|
#[API\ApiFilter(SearchFilter::class, strategy: 'exact')]
|
|
public ProjectApiResource $project;
|
|
|
|
#[API\ApiFilter(SearchFilter::class, strategy: 'exact')]
|
|
public UserApiResource $reviewer;
|
|
|
|
#[API\ApiFilter(SearchFilter::class, strategy: 'exact')]
|
|
public ReviewType $type;
|
|
|
|
/**
|
|
* @var ReviewAreaApiResource[]
|
|
*/
|
|
public array $areas;
|
|
}
|