Explorar el Código

partner fix task fix

master
Florian Eisenmenger hace 2 años
padre
commit
a0d33182ef
Se han modificado 7 ficheros con 169 adiciones y 16 borrados
  1. +1
    -1
      export/openapi.json
  2. +145
    -12
      export/openapi.yaml
  3. +1
    -1
      src/ApiResource/PartnerApi.php
  4. +16
    -0
      src/ApiResource/TaskApi.php
  5. +1
    -1
      src/Mapper/PartnerApiToEntityMapper.php
  6. +1
    -1
      src/Mapper/PartnerEntityToApiMapper.php
  7. +4
    -0
      src/Mapper/TaskEntityToApiMapper.php

+ 1
- 1
export/openapi.json
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 145
- 12
export/openapi.yaml Ver fichero

@@ -500,9 +500,9 @@ paths:
required: true
deprecated: false
parameters: []
/api/media:
/api/medias:
get:
operationId: api_media_get_collection
operationId: api_medias_get_collection
tags:
- Media
responses:
@@ -573,7 +573,7 @@ paths:
allowReserved: false
deprecated: false
post:
operationId: api_media_post
operationId: api_medias_post
tags:
- Media
responses:
@@ -613,9 +613,9 @@ paths:
required: false
deprecated: false
parameters: []
'/api/media/{id}':
'/api/medias/{id}':
get:
operationId: api_media_id_get
operationId: api_medias_id_get
tags:
- Media
responses:
@@ -653,7 +653,7 @@ paths:
allowReserved: false
deprecated: false
delete:
operationId: api_media_id_delete
operationId: api_medias_id_delete
tags:
- Media
responses:
@@ -1586,6 +1586,58 @@ paths:
style: form
explode: false
allowReserved: false
-
name: partner
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'partner[]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: array
items:
type: string
style: form
explode: true
allowReserved: false
-
name: contact
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'contact[]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: array
items:
type: string
style: form
explode: true
allowReserved: false
deprecated: false
post:
operationId: api_tasks_post
@@ -2450,11 +2502,11 @@ components:
deprecated: false
required:
- name
- type
- partnerType
properties:
name:
type: string
type:
partnerType:
type: string
enum:
- customer
@@ -2502,6 +2554,13 @@ components:
- string
- 'null'
format: date-time
posts:
readOnly: true
type: array
items:
type: string
format: iri-reference
example: 'https://example.com/'
contacts:
readOnly: true
type: array
@@ -2515,7 +2574,7 @@ components:
deprecated: false
required:
- name
- type
- partnerType
properties:
_links:
type: object
@@ -2528,7 +2587,7 @@ components:
format: iri-reference
name:
type: string
type:
partnerType:
type: string
enum:
- customer
@@ -2576,6 +2635,13 @@ components:
- string
- 'null'
format: date-time
posts:
readOnly: true
type: array
items:
type: string
format: iri-reference
example: 'https://example.com/'
contacts:
readOnly: true
type: array
@@ -2589,7 +2655,7 @@ components:
deprecated: false
required:
- name
- type
- partnerType
properties:
'@context':
readOnly: true
@@ -2616,7 +2682,7 @@ components:
type: string
name:
type: string
type:
partnerType:
type: string
enum:
- customer
@@ -2664,6 +2730,13 @@ components:
- string
- 'null'
format: date-time
posts:
readOnly: true
type: array
items:
type: string
format: iri-reference
example: 'https://example.com/'
contacts:
readOnly: true
type: array
@@ -3129,6 +3202,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
createdByName:
readOnly: true
type:
- string
- 'null'
assignedTo:
'owl:maxCardinality': 1
type:
@@ -3136,6 +3214,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
assignedToName:
readOnly: true
type:
- string
- 'null'
dueAt:
type:
- string
@@ -3148,6 +3231,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerName:
readOnly: true
type:
- string
- 'null'
contact:
'owl:maxCardinality': 1
type:
@@ -3155,6 +3243,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
contactName:
readOnly: true
type:
- string
- 'null'
prio:
type: string
enum:
@@ -3207,6 +3300,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
createdByName:
readOnly: true
type:
- string
- 'null'
assignedTo:
'owl:maxCardinality': 1
type:
@@ -3214,6 +3312,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
assignedToName:
readOnly: true
type:
- string
- 'null'
dueAt:
type:
- string
@@ -3226,6 +3329,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerName:
readOnly: true
type:
- string
- 'null'
contact:
'owl:maxCardinality': 1
type:
@@ -3233,6 +3341,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
contactName:
readOnly: true
type:
- string
- 'null'
prio:
type: string
enum:
@@ -3299,6 +3412,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
createdByName:
readOnly: true
type:
- string
- 'null'
assignedTo:
'owl:maxCardinality': 1
type:
@@ -3306,6 +3424,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
assignedToName:
readOnly: true
type:
- string
- 'null'
dueAt:
type:
- string
@@ -3318,6 +3441,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerName:
readOnly: true
type:
- string
- 'null'
contact:
'owl:maxCardinality': 1
type:
@@ -3325,6 +3453,11 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
contactName:
readOnly: true
type:
- string
- 'null'
prio:
type: string
enum:


+ 1
- 1
src/ApiResource/PartnerApi.php Ver fichero

@@ -60,7 +60,7 @@ class PartnerApi
public string $name;

#[NotBlank]
public PartnerType $type;
public PartnerType $partnerType;

public ?string $street = null;



+ 16
- 0
src/ApiResource/TaskApi.php Ver fichero

@@ -7,7 +7,9 @@

namespace App\ApiResource;

use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Doctrine\Orm\State\Options;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
@@ -41,11 +43,13 @@ use Symfony\Component\Validator\Constraints as Assert;
security: 'is_granted("ROLE_USER")',
)
],
order: ['dueAt' => 'DESC'],
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: Task::class),
)]
#[ApiFilter(SearchFilter::class, properties: ['partner' => 'exact', 'contact' => 'exact'])]
class TaskApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
@@ -60,16 +64,28 @@ class TaskApi
#[ApiProperty(writable: false)]
public ?UserApi $createdBy = null;

#[ApiProperty(writable: false)]
public ?string $createdByName = null;

#[Assert\NotBlank]
public ?UserApi $assignedTo = null;

#[ApiProperty(writable: false)]
public ?string $assignedToName = null;

#[Assert\NotBlank]
public ?\DateTimeImmutable $dueAt = null;

public ?PartnerApi $partner = null;

#[ApiProperty(writable: false)]
public ?string $partnerName = null;

public ?ContactApi $contact = null;

#[ApiProperty(writable: false)]
public ?string $contactName = null;

#[Assert\NotBlank]
public PrioType $prio;



+ 1
- 1
src/Mapper/PartnerApiToEntityMapper.php Ver fichero

@@ -46,7 +46,7 @@ class PartnerApiToEntityMapper implements MapperInterface
assert($entity instanceof Partner);

$entity->setName($dto->name);
$entity->setType($dto->type);
$entity->setType($dto->partnerType);
$entity->setStreet($dto->street);
$entity->setStreetNo($dto->streetNo);
$entity->setZip($dto->zip);


+ 1
- 1
src/Mapper/PartnerEntityToApiMapper.php Ver fichero

@@ -42,7 +42,7 @@ class PartnerEntityToApiMapper implements MapperInterface
assert($dto instanceof PartnerApi);

$dto->name = $entity->getName();
$dto->type = $entity->getType();
$dto->partnerType = $entity->getType();
$dto->street = $entity->getStreet();
$dto->streetNo = $entity->getStreetNo();
$dto->zip = $entity->getZip();


+ 4
- 0
src/Mapper/TaskEntityToApiMapper.php Ver fichero

@@ -47,21 +47,25 @@ class TaskEntityToApiMapper implements MapperInterface
$dto->createdBy = $this->microMapper->map($entity->getCreatedBy(), UserApi::class, [
MicroMapperInterface::MAX_DEPTH => 1,
]);
$dto->createdByName = $entity->getCreatedBy()?->getFirstName()." ".$entity->getCreatedBy()?->getLastName();
$dto->assignedTo = $this->microMapper->map($entity->getAssignedTo(), UserApi::class, [
MicroMapperInterface::MAX_DEPTH => 1,
]);
$dto->assignedToName = $entity->getAssignedTo()?->getFirstName()." ".$entity->getAssignedTo()?->getLastName();
$dto->dueAt = $entity->getDueAt();

if ($entity->getPartner()) {
$dto->partner = $this->microMapper->map($entity->getPartner(), PartnerApi::class, [
MicroMapperInterface::MAX_DEPTH => 1,
]);
$dto->partnerName = $entity->getPartner()?->getName();
}

if ($entity->getContact() !== null) {
$dto->contact = $this->microMapper->map($entity->getContact(), ContactApi::class, [
MicroMapperInterface::MAX_DEPTH => 1,
]);
$dto->contactName = $entity->getContact()?->getFirstName()." ".$entity->getContact()?->getLastName();
}

$dto->prio = $entity->getPrio();


Cargando…
Cancelar
Guardar