Florian Eisenmenger преди 1 година
родител
ревизия
7031636097
променени са 9 файла, в които са добавени 635 реда и са изтрити 78 реда
  1. +1
    -1
      export/openapi.json
  2. +616
    -70
      export/openapi.yaml
  3. +3
    -0
      src/ApiResource/DocumentApi.php
  4. +1
    -1
      src/ApiResource/PartnerApi.php
  5. +1
    -1
      src/ApiResource/PartnerFollowApi.php
  6. +2
    -0
      src/ApiResource/ProductApi.php
  7. +1
    -1
      src/ApiResource/TaskApi.php
  8. +4
    -1
      src/Mapper/DocumentEntityToApiMapper.php
  9. +6
    -3
      src/Service/FileUrlService.php

+ 1
- 1
export/openapi.json
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 616
- 70
export/openapi.yaml Целия файл

@@ -500,6 +500,184 @@ paths:
required: true
deprecated: false
parameters: []
/api/document_objects:
get:
operationId: api_document_objects_get_collection
tags:
- DocumentObject
responses:
200:
description: 'DocumentObject collection'
content:
application/ld+json:
schema:
type: object
properties:
'hydra:member': { type: array, items: { $ref: '#/components/schemas/DocumentObject.jsonld-document_object.read' } }
'hydra:totalItems': { type: integer, minimum: 0 }
'hydra:view': { type: object, properties: { '@id': { type: string, format: iri-reference }, '@type': { type: string }, 'hydra:first': { type: string, format: iri-reference }, 'hydra:last': { type: string, format: iri-reference }, 'hydra:previous': { type: string, format: iri-reference }, 'hydra:next': { type: string, format: iri-reference } }, example: { '@id': string, type: string, 'hydra:first': string, 'hydra:last': string, 'hydra:previous': string, 'hydra:next': string } }
'hydra:search': { type: object, properties: { '@type': { type: string }, 'hydra:template': { type: string }, 'hydra:variableRepresentation': { type: string }, 'hydra:mapping': { type: array, items: { type: object, properties: { '@type': { type: string }, variable: { type: string }, property: { type: [string, 'null'] }, required: { type: boolean } } } } } }
required:
- 'hydra:member'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DocumentObject-document_object.read'
text/html:
schema:
type: array
items:
$ref: '#/components/schemas/DocumentObject-document_object.read'
application/hal+json:
schema:
type: object
properties:
_embedded: { type: array, items: { $ref: '#/components/schemas/DocumentObject.jsonhal-document_object.read' } }
totalItems: { type: integer, minimum: 0 }
itemsPerPage: { type: integer, minimum: 0 }
_links: { type: object, properties: { self: { type: object, properties: { href: { type: string, format: iri-reference } } }, first: { type: object, properties: { href: { type: string, format: iri-reference } } }, last: { type: object, properties: { href: { type: string, format: iri-reference } } }, next: { type: object, properties: { href: { type: string, format: iri-reference } } }, previous: { type: object, properties: { href: { type: string, format: iri-reference } } } } }
required:
- _links
- _embedded
summary: 'Retrieves the collection of DocumentObject resources.'
description: 'Retrieves the collection of DocumentObject resources.'
parameters:
-
name: page
in: query
description: 'The collection page number'
required: false
deprecated: false
allowEmptyValue: true
schema:
type: integer
default: 1
style: form
explode: false
allowReserved: false
-
name: itemsPerPage
in: query
description: 'The number of items per page'
required: false
deprecated: false
allowEmptyValue: true
schema:
type: integer
default: 10
minimum: 0
maximum: 50
style: form
explode: false
allowReserved: false
deprecated: false
post:
operationId: api_document_objects_post
tags:
- DocumentObject
responses:
201:
description: 'DocumentObject resource created'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/DocumentObject.jsonld-document_object.read'
application/json:
schema:
$ref: '#/components/schemas/DocumentObject-document_object.read'
text/html:
schema:
$ref: '#/components/schemas/DocumentObject-document_object.read'
application/hal+json:
schema:
$ref: '#/components/schemas/DocumentObject.jsonhal-document_object.read'
links: { }
400:
description: 'Invalid input'
422:
description: 'Unprocessable entity'
summary: 'Creates a DocumentObject resource.'
description: 'Creates a DocumentObject resource.'
parameters: []
requestBody:
description: ''
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
required: false
deprecated: false
parameters: []
'/api/document_objects/{id}':
get:
operationId: api_document_objects_id_get
tags:
- DocumentObject
responses:
200:
description: 'DocumentObject resource'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/DocumentObject.jsonld-document_object.read'
application/json:
schema:
$ref: '#/components/schemas/DocumentObject-document_object.read'
text/html:
schema:
$ref: '#/components/schemas/DocumentObject-document_object.read'
application/hal+json:
schema:
$ref: '#/components/schemas/DocumentObject.jsonhal-document_object.read'
404:
description: 'Resource not found'
summary: 'Retrieves a DocumentObject resource.'
description: 'Retrieves a DocumentObject resource.'
parameters:
-
name: id
in: path
description: 'DocumentObject identifier'
required: true
deprecated: false
allowEmptyValue: false
schema:
type: string
style: simple
explode: false
allowReserved: false
deprecated: false
delete:
operationId: api_document_objects_id_delete
tags:
- DocumentObject
responses:
204:
description: 'DocumentObject resource deleted'
404:
description: 'Resource not found'
summary: 'Removes the DocumentObject resource.'
description: 'Removes the DocumentObject resource.'
parameters:
-
name: id
in: path
description: 'DocumentObject identifier'
required: true
deprecated: false
allowEmptyValue: false
schema:
type: string
style: simple
explode: false
allowReserved: false
deprecated: false
parameters: []
/api/documents:
get:
operationId: api_documents_get_collection
@@ -513,7 +691,7 @@ paths:
schema:
type: object
properties:
'hydra:member': { type: array, items: { $ref: '#/components/schemas/Document.jsonld-document_object.read' } }
'hydra:member': { type: array, items: { $ref: '#/components/schemas/Document.jsonld' } }
'hydra:totalItems': { type: integer, minimum: 0 }
'hydra:view': { type: object, properties: { '@id': { type: string, format: iri-reference }, '@type': { type: string }, 'hydra:first': { type: string, format: iri-reference }, 'hydra:last': { type: string, format: iri-reference }, 'hydra:previous': { type: string, format: iri-reference }, 'hydra:next': { type: string, format: iri-reference } }, example: { '@id': string, type: string, 'hydra:first': string, 'hydra:last': string, 'hydra:previous': string, 'hydra:next': string } }
'hydra:search': { type: object, properties: { '@type': { type: string }, 'hydra:template': { type: string }, 'hydra:variableRepresentation': { type: string }, 'hydra:mapping': { type: array, items: { type: object, properties: { '@type': { type: string }, variable: { type: string }, property: { type: [string, 'null'] }, required: { type: boolean } } } } } }
@@ -523,17 +701,17 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/Document-document_object.read'
$ref: '#/components/schemas/Document'
text/html:
schema:
type: array
items:
$ref: '#/components/schemas/Document-document_object.read'
$ref: '#/components/schemas/Document'
application/hal+json:
schema:
type: object
properties:
_embedded: { type: array, items: { $ref: '#/components/schemas/Document.jsonhal-document_object.read' } }
_embedded: { type: array, items: { $ref: '#/components/schemas/Document.jsonhal' } }
totalItems: { type: integer, minimum: 0 }
itemsPerPage: { type: integer, minimum: 0 }
_links: { type: object, properties: { self: { type: object, properties: { href: { type: string, format: iri-reference } } }, first: { type: object, properties: { href: { type: string, format: iri-reference } } }, last: { type: object, properties: { href: { type: string, format: iri-reference } } }, next: { type: object, properties: { href: { type: string, format: iri-reference } } }, previous: { type: object, properties: { href: { type: string, format: iri-reference } } } } }
@@ -634,16 +812,16 @@ paths:
content:
application/ld+json:
schema:
$ref: '#/components/schemas/Document.jsonld-document_object.read'
$ref: '#/components/schemas/Document.jsonld'
application/json:
schema:
$ref: '#/components/schemas/Document-document_object.read'
$ref: '#/components/schemas/Document'
text/html:
schema:
$ref: '#/components/schemas/Document-document_object.read'
$ref: '#/components/schemas/Document'
application/hal+json:
schema:
$ref: '#/components/schemas/Document.jsonhal-document_object.read'
$ref: '#/components/schemas/Document.jsonhal'
links: { }
400:
description: 'Invalid input'
@@ -653,24 +831,21 @@ paths:
description: 'Creates a Document resource.'
parameters: []
requestBody:
description: ''
description: 'The new Document resource'
content:
multipart/form-data:
application/ld+json:
schema:
type: object
properties:
file:
type: string
format: binary
partner:
type: string
format: iri_reference
example: 'https://example.com/'
product:
type: string
format: iri_reference
example: 'https://example.com/'
required: false
$ref: '#/components/schemas/Document.jsonld'
application/json:
schema:
$ref: '#/components/schemas/Document'
text/html:
schema:
$ref: '#/components/schemas/Document'
application/hal+json:
schema:
$ref: '#/components/schemas/Document.jsonhal'
required: true
deprecated: false
parameters: []
'/api/documents/{id}':
@@ -684,16 +859,16 @@ paths:
content:
application/ld+json:
schema:
$ref: '#/components/schemas/Document.jsonld-document_object.read'
$ref: '#/components/schemas/Document.jsonld'
application/json:
schema:
$ref: '#/components/schemas/Document-document_object.read'
$ref: '#/components/schemas/Document'
text/html:
schema:
$ref: '#/components/schemas/Document-document_object.read'
$ref: '#/components/schemas/Document'
application/hal+json:
schema:
$ref: '#/components/schemas/Document.jsonhal-document_object.read'
$ref: '#/components/schemas/Document.jsonhal'
404:
description: 'Resource not found'
summary: 'Retrieves a Document resource.'
@@ -702,7 +877,7 @@ paths:
-
name: id
in: path
description: 'DocumentObject identifier'
description: 'DocumentApi identifier'
required: true
deprecated: false
allowEmptyValue: false
@@ -727,7 +902,50 @@ paths:
-
name: id
in: path
description: 'DocumentObject identifier'
description: 'DocumentApi identifier'
required: true
deprecated: false
allowEmptyValue: false
schema:
type: string
style: simple
explode: false
allowReserved: false
deprecated: false
patch:
operationId: api_documents_id_patch
tags:
- Document
responses:
200:
description: 'Document resource updated'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/Document.jsonld'
application/json:
schema:
$ref: '#/components/schemas/Document'
text/html:
schema:
$ref: '#/components/schemas/Document'
application/hal+json:
schema:
$ref: '#/components/schemas/Document.jsonhal'
links: { }
400:
description: 'Invalid input'
422:
description: 'Unprocessable entity'
404:
description: 'Resource not found'
summary: 'Updates the Document resource.'
description: 'Updates the Document resource.'
parameters:
-
name: id
in: path
description: 'DocumentApi identifier'
required: true
deprecated: false
allowEmptyValue: false
@@ -736,22 +954,29 @@ paths:
style: simple
explode: false
allowReserved: false
requestBody:
description: 'The updated Document resource'
content:
application/merge-patch+json:
schema:
$ref: '#/components/schemas/Document'
required: true
deprecated: false
parameters: []
/api/medias:
/api/media_objects:
get:
operationId: api_medias_get_collection
operationId: api_media_objects_get_collection
tags:
- Media
- MediaObject
responses:
200:
description: 'Media collection'
description: 'MediaObject collection'
content:
application/ld+json:
schema:
type: object
properties:
'hydra:member': { type: array, items: { $ref: '#/components/schemas/Media.jsonld-media_object.read' } }
'hydra:member': { type: array, items: { $ref: '#/components/schemas/MediaObject.jsonld-media_object.read' } }
'hydra:totalItems': { type: integer, minimum: 0 }
'hydra:view': { type: object, properties: { '@id': { type: string, format: iri-reference }, '@type': { type: string }, 'hydra:first': { type: string, format: iri-reference }, 'hydra:last': { type: string, format: iri-reference }, 'hydra:previous': { type: string, format: iri-reference }, 'hydra:next': { type: string, format: iri-reference } }, example: { '@id': string, type: string, 'hydra:first': string, 'hydra:last': string, 'hydra:previous': string, 'hydra:next': string } }
'hydra:search': { type: object, properties: { '@type': { type: string }, 'hydra:template': { type: string }, 'hydra:variableRepresentation': { type: string }, 'hydra:mapping': { type: array, items: { type: object, properties: { '@type': { type: string }, variable: { type: string }, property: { type: [string, 'null'] }, required: { type: boolean } } } } } }
@@ -761,25 +986,25 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/Media-media_object.read'
$ref: '#/components/schemas/MediaObject-media_object.read'
text/html:
schema:
type: array
items:
$ref: '#/components/schemas/Media-media_object.read'
$ref: '#/components/schemas/MediaObject-media_object.read'
application/hal+json:
schema:
type: object
properties:
_embedded: { type: array, items: { $ref: '#/components/schemas/Media.jsonhal-media_object.read' } }
_embedded: { type: array, items: { $ref: '#/components/schemas/MediaObject.jsonhal-media_object.read' } }
totalItems: { type: integer, minimum: 0 }
itemsPerPage: { type: integer, minimum: 0 }
_links: { type: object, properties: { self: { type: object, properties: { href: { type: string, format: iri-reference } } }, first: { type: object, properties: { href: { type: string, format: iri-reference } } }, last: { type: object, properties: { href: { type: string, format: iri-reference } } }, next: { type: object, properties: { href: { type: string, format: iri-reference } } }, previous: { type: object, properties: { href: { type: string, format: iri-reference } } } } }
required:
- _links
- _embedded
summary: 'Retrieves the collection of Media resources.'
description: 'Retrieves the collection of Media resources.'
summary: 'Retrieves the collection of MediaObject resources.'
description: 'Retrieves the collection of MediaObject resources.'
parameters:
-
name: page
@@ -811,32 +1036,32 @@ paths:
allowReserved: false
deprecated: false
post:
operationId: api_medias_post
operationId: api_media_objects_post
tags:
- Media
- MediaObject
responses:
201:
description: 'Media resource created'
description: 'MediaObject resource created'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/Media.jsonld-media_object.read'
$ref: '#/components/schemas/MediaObject.jsonld-media_object.read'
application/json:
schema:
$ref: '#/components/schemas/Media-media_object.read'
$ref: '#/components/schemas/MediaObject-media_object.read'
text/html:
schema:
$ref: '#/components/schemas/Media-media_object.read'
$ref: '#/components/schemas/MediaObject-media_object.read'
application/hal+json:
schema:
$ref: '#/components/schemas/Media.jsonhal-media_object.read'
$ref: '#/components/schemas/MediaObject.jsonhal-media_object.read'
links: { }
400:
description: 'Invalid input'
422:
description: 'Unprocessable entity'
summary: 'Creates a Media resource.'
description: 'Creates a Media resource.'
summary: 'Creates a MediaObject resource.'
description: 'Creates a MediaObject resource.'
parameters: []
requestBody:
description: ''
@@ -851,31 +1076,31 @@ paths:
required: false
deprecated: false
parameters: []
'/api/medias/{id}':
'/api/media_objects/{id}':
get:
operationId: api_medias_id_get
operationId: api_media_objects_id_get
tags:
- Media
- MediaObject
responses:
200:
description: 'Media resource'
description: 'MediaObject resource'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/Media.jsonld-media_object.read'
$ref: '#/components/schemas/MediaObject.jsonld-media_object.read'
application/json:
schema:
$ref: '#/components/schemas/Media-media_object.read'
$ref: '#/components/schemas/MediaObject-media_object.read'
text/html:
schema:
$ref: '#/components/schemas/Media-media_object.read'
$ref: '#/components/schemas/MediaObject-media_object.read'
application/hal+json:
schema:
$ref: '#/components/schemas/Media.jsonhal-media_object.read'
$ref: '#/components/schemas/MediaObject.jsonhal-media_object.read'
404:
description: 'Resource not found'
summary: 'Retrieves a Media resource.'
description: 'Retrieves a Media resource.'
summary: 'Retrieves a MediaObject resource.'
description: 'Retrieves a MediaObject resource.'
parameters:
-
name: id
@@ -891,16 +1116,16 @@ paths:
allowReserved: false
deprecated: false
delete:
operationId: api_medias_id_delete
operationId: api_media_objects_id_delete
tags:
- Media
- MediaObject
responses:
204:
description: 'Media resource deleted'
description: 'MediaObject resource deleted'
404:
description: 'Resource not found'
summary: 'Removes the Media resource.'
description: 'Removes the Media resource.'
summary: 'Removes the MediaObject resource.'
description: 'Removes the MediaObject resource.'
parameters:
-
name: id
@@ -1013,6 +1238,32 @@ paths:
style: form
explode: true
allowReserved: false
-
name: user
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'user[]'
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_partner_follows_post
@@ -1222,6 +1473,18 @@ paths:
style: form
explode: true
allowReserved: false
-
name: name
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'order[name]'
in: query
@@ -1785,6 +2048,18 @@ paths:
style: form
explode: false
allowReserved: false
-
name: name
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'order[name]'
in: query
@@ -2650,6 +2925,32 @@ paths:
style: form
explode: false
allowReserved: false
-
name: assignedTo
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'assignedTo[]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: array
items:
type: string
style: form
explode: true
allowReserved: false
-
name: partner
in: query
@@ -3516,7 +3817,252 @@ components:
- string
- 'null'
format: date-time
Document-document_object.read:
Document:
type: object
description: ''
deprecated: false
properties:
createdBy:
readOnly: true
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
createdByName:
readOnly: true
type:
- string
- 'null'
name:
type:
- string
- 'null'
description:
type:
- string
- 'null'
partner:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerName:
readOnly: true
type:
- string
- 'null'
product:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
readOnly: true
type:
- string
- 'null'
documentObject:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
documentUrl:
readOnly: true
type:
- string
- 'null'
createdAt:
readOnly: true
type:
- string
- 'null'
format: date-time
required:
- name
- documentObject
Document.jsonhal:
type: object
description: ''
deprecated: false
properties:
_links:
type: object
properties:
self:
type: object
properties:
href:
type: string
format: iri-reference
createdBy:
readOnly: true
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
createdByName:
readOnly: true
type:
- string
- 'null'
name:
type:
- string
- 'null'
description:
type:
- string
- 'null'
partner:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerName:
readOnly: true
type:
- string
- 'null'
product:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
readOnly: true
type:
- string
- 'null'
documentObject:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
documentUrl:
readOnly: true
type:
- string
- 'null'
createdAt:
readOnly: true
type:
- string
- 'null'
format: date-time
required:
- name
- documentObject
Document.jsonld:
type: object
description: ''
deprecated: false
properties:
'@context':
readOnly: true
oneOf:
-
type: string
-
type: object
properties:
'@vocab':
type: string
hydra:
type: string
enum: ['http://www.w3.org/ns/hydra/core#']
required:
- '@vocab'
- hydra
additionalProperties: true
'@id':
readOnly: true
type: string
'@type':
readOnly: true
type: string
createdBy:
readOnly: true
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
createdByName:
readOnly: true
type:
- string
- 'null'
name:
type:
- string
- 'null'
description:
type:
- string
- 'null'
partner:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerName:
readOnly: true
type:
- string
- 'null'
product:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
readOnly: true
type:
- string
- 'null'
documentObject:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
documentUrl:
readOnly: true
type:
- string
- 'null'
createdAt:
readOnly: true
type:
- string
- 'null'
format: date-time
required:
- name
- documentObject
DocumentObject-document_object.read:
type: object
description: ''
deprecated: false
@@ -3529,7 +4075,7 @@ components:
type:
- string
- 'null'
Document.jsonhal-document_object.read:
DocumentObject.jsonhal-document_object.read:
type: object
description: ''
deprecated: false
@@ -3551,7 +4097,7 @@ components:
type:
- string
- 'null'
Document.jsonld-document_object.read:
DocumentObject.jsonld-document_object.read:
type: object
description: ''
deprecated: false
@@ -3587,7 +4133,7 @@ components:
type:
- string
- 'null'
Media-media_object.read:
MediaObject-media_object.read:
type: object
description: ''
deprecated: false
@@ -3600,7 +4146,7 @@ components:
type:
- string
- 'null'
Media.jsonhal-media_object.read:
MediaObject.jsonhal-media_object.read:
type: object
description: ''
deprecated: false
@@ -3622,7 +4168,7 @@ components:
type:
- string
- 'null'
Media.jsonld-media_object.read:
MediaObject.jsonld-media_object.read:
type: object
description: ''
deprecated: false


+ 3
- 0
src/ApiResource/DocumentApi.php Целия файл

@@ -82,6 +82,9 @@ class DocumentApi
#[NotBlank]
public ?DocumentObject $documentObject = null;

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

#[ApiProperty(writable: false)]
public ?\DateTimeImmutable $createdAt = null;
}

+ 1
- 1
src/ApiResource/PartnerApi.php Целия файл

@@ -49,7 +49,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: Partner::class)
)]
#[ApiFilter(SearchFilter::class, properties: ['type' => 'exact'])]
#[ApiFilter(SearchFilter::class, properties: ['type' => 'exact', 'name' => 'ipartial'])]
#[ApiFilter(OrderFilter::class, properties: ['name', 'city', 'website'], arguments: ['orderParameterName' => 'order'])]
class PartnerApi
{


+ 1
- 1
src/ApiResource/PartnerFollowApi.php Целия файл

@@ -45,7 +45,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: PartnerFollow::class),
)]
#[ApiFilter(SearchFilter::class, properties: ['partner' => 'exact', 'contact' => 'exact'])]
#[ApiFilter(SearchFilter::class, properties: ['partner' => 'exact', 'user' => 'exact'])]
class PartnerFollowApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]


+ 2
- 0
src/ApiResource/ProductApi.php Целия файл

@@ -9,6 +9,7 @@ namespace App\ApiResource;


use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Doctrine\Orm\State\Options;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
@@ -48,6 +49,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
stateOptions: new Options(entityClass: Product::class)
)]

#[ApiFilter(SearchFilter::class, properties: ['name' => 'ipartial'])]
#[ApiFilter(OrderFilter::class, properties: ['name'], arguments: ['orderParameterName' => 'order'])]
class ProductApi
{


+ 1
- 1
src/ApiResource/TaskApi.php Целия файл

@@ -51,7 +51,7 @@ use Symfony\Component\Validator\Constraints as Assert;
stateOptions: new Options(entityClass: Task::class),
)]
#[ApiFilter(SearchFilter::class, properties: [
'owner' => 'exact',
'assignedTo' => 'exact',
'partner' => 'exact',
'contact' => 'exact'
])]


+ 4
- 1
src/Mapper/DocumentEntityToApiMapper.php Целия файл

@@ -10,6 +10,7 @@ use App\ApiResource\UserApi;
use App\ApiResource\PostingApi;
use App\Entity\Comment;
use App\Entity\Document;
use App\Service\FileUrlService;
use Symfonycasts\MicroMapper\AsMapper;
use Symfonycasts\MicroMapper\MapperInterface;
use Symfonycasts\MicroMapper\MicroMapperInterface;
@@ -18,7 +19,8 @@ use Symfonycasts\MicroMapper\MicroMapperInterface;
class DocumentEntityToApiMapper implements MapperInterface
{
public function __construct(
private MicroMapperInterface $microMapper
private MicroMapperInterface $microMapper,
private FileUrlService $fileUrlService
)
{
}
@@ -63,6 +65,7 @@ class DocumentEntityToApiMapper implements MapperInterface
}

$dto->documentObject = $entity->getDocumentObject();
$dto->documentUrl = $this->fileUrlService->getFileUrl($entity->getDocumentObject());
$dto->createdAt = $entity->getCreatedAt();

return $dto;


+ 6
- 3
src/Service/FileUrlService.php Целия файл

@@ -8,9 +8,11 @@
namespace App\Service;


use App\Entity\DocumentObject;
use App\Entity\MediaObject;
use Symfony\Component\HttpFoundation\RequestStack;
use Vich\UploaderBundle\Storage\StorageInterface;
use function Zenstruck\Foundry\instantiate;

class FileUrlService
{
@@ -20,13 +22,14 @@ class FileUrlService
private StorageInterface $storage,
){}

public function getFileUrl(?MediaObject $mediaObject)
public function getFileUrl(?object $object)
{
if ($mediaObject !== null) {
if ($object !== null) {
assert($object instanceof MediaObject || $object instanceof DocumentObject);
$currentRequest = $this->requestStack->getCurrentRequest();
if ($currentRequest !== null) {
$apiUrl = $currentRequest->getSchemeAndHttpHost();
$imageUri = $this->storage->resolveUri($mediaObject, 'file');
$imageUri = $this->storage->resolveUri($object, 'file');
return $apiUrl . $imageUri;
}
}


Зареждане…
Отказ
Запис