diff --git a/src/ApiResource/User/OrganizationApiResource.php b/src/ApiResource/User/OrganizationApiResource.php new file mode 100644 index 0000000..fe32eb9 --- /dev/null +++ b/src/ApiResource/User/OrganizationApiResource.php @@ -0,0 +1,69 @@ + new API\Link( + fromClass: UserApiResource::class, + fromProperty: 'Organization' + ), + ] +)] +#[API\Get()] +#[API\Patch( + securityPostDenormalize: 'is_granted("ORGANIZATION_EDIT", previous_object)', +)] +class OrganizationApiResource +{ + #[API\ApiProperty(identifier: true, writable: false)] + public UserApiResource $user; + + /** + * ID for tax purposes. e.g: NIF (formerly CIF), Umsatzsteuer-Id, EID, etc. + */ + #[API\ApiProperty( + securityPostDenormalize: 'is_granted("ORGANIZATION_EDIT", previous_object)', + )] + #[Assert\NotBlank()] + public string $taxId; + + /** + * Organization legal name before government, + * as it appears on legal documents issued by or for this organization.\ + * Will be used as last option for the display name of the User. + */ + #[API\ApiProperty( + securityPostDenormalize: 'is_granted("ORGANIZATION_EDIT", previous_object)', + )] + #[Assert\NotBlank()] + public string $legalName; + + /** + * The name under which the organization presents itself.\ + * Might be similar to the legal name or completely different.\ + * Will be used as display name for the User when present. + */ + #[API\ApiProperty( + securityPostDenormalize: 'is_granted("ORGANIZATION_EDIT", previous_object)', + )] + public string $businessName; +} diff --git a/src/OpenApi/RedocExtensionsTrait.php b/src/OpenApi/RedocExtensionsTrait.php index 74cf150..ab60a4c 100644 --- a/src/OpenApi/RedocExtensionsTrait.php +++ b/src/OpenApi/RedocExtensionsTrait.php @@ -21,7 +21,7 @@ trait RedocExtensionsTrait $groups = [ [ 'name' => 'Users', - 'tags' => ['User', 'UserToken', 'Person'], + 'tags' => ['User', 'UserToken', 'Person', 'Organization'], ], [ 'name' => 'Projects',