Przeglądaj źródła

partner fix task fix

master
Florian Eisenmenger 2 lat temu
rodzic
commit
a0d33182ef
7 zmienionych plików z 169 dodań i 16 usunięć
  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
Plik diff jest za duży
Wyświetl plik


+ 145
- 12
export/openapi.yaml Wyświetl plik

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


+ 1
- 1
src/ApiResource/PartnerApi.php Wyświetl plik

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


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


public ?string $street = null; public ?string $street = null;




+ 16
- 0
src/ApiResource/TaskApi.php Wyświetl plik

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


namespace App\ApiResource; namespace App\ApiResource;


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


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

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


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

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


public ?PartnerApi $partner = null; public ?PartnerApi $partner = null;


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

public ?ContactApi $contact = null; public ?ContactApi $contact = null;


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

#[Assert\NotBlank] #[Assert\NotBlank]
public PrioType $prio; public PrioType $prio;




+ 1
- 1
src/Mapper/PartnerApiToEntityMapper.php Wyświetl plik

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


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


+ 1
- 1
src/Mapper/PartnerEntityToApiMapper.php Wyświetl plik

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


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


+ 4
- 0
src/Mapper/TaskEntityToApiMapper.php Wyświetl plik

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


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


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


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


Ładowanie…
Anuluj
Zapisz