Skip to content

Commit

Permalink
Add images use generic search index only
Browse files Browse the repository at this point in the history
  • Loading branch information
alexz707 committed Feb 28, 2024
1 parent b8a6b9a commit 2558c3a
Show file tree
Hide file tree
Showing 67 changed files with 1,939 additions and 364 deletions.
8 changes: 5 additions & 3 deletions config/api_platform/resources/asset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
operations:
ApiPlatform\Metadata\GetCollection:
filters: [ Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter ]
filters:
- Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter
- Pimcore\Bundle\StudioApiBundle\Filter\AssetIdSearchFilter
paginationClientItemsPerPage: true
ApiPlatform\Metadata\Get:
normalizationContext:
groups: [ 'asset:read', 'asset:item:get', 'dependency:read', 'property:read']
groups: [ 'asset:read', 'asset:item:get', 'dependency:read', 'property:read', 'element:read', 'element:item:get']
ApiPlatform\Metadata\Put:
ApiPlatform\Metadata\Post:
ApiPlatform\Metadata\Delete:
ApiPlatform\Metadata\Patch:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
normalizationContext:
groups: ['asset:read', 'dependency:read', 'property:read']
groups: ['asset:read', 'dependency:read', 'property:read', 'element:read']
denormalizationContext:
groups: ['asset:write']
properties:
Expand Down
8 changes: 6 additions & 2 deletions config/api_platform/resources/asset/image.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Image:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
operations:
ApiPlatform\Metadata\Get:
normalizationContext:
groups: ['image:read', 'asset:read', 'asset:item:get', 'dependency:read', 'property:read', 'element:read', 'element:item:get' ]
properties:
id:
identifier: true
normalizationContext:
groups: ['image:read', 'asset:read', 'task:read', 'dependency:read', 'property:read', 'version:read']
groups: ['image:read', 'asset:read', 'dependency:read', 'property:read', 'element:read']
denormalizationContext:
groups: ['image:write', 'asset:write']
groups: ['image:write', 'asset:write']
5 changes: 4 additions & 1 deletion config/api_platform/resources/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ resources:
input: Pimcore\Bundle\StudioApiBundle\Dto\ResetPasswordRequest
output: false
uriTemplate: '/users/reset-password'

ApiPlatform\Metadata\Get:
normalizationContext:
groups: [ 'user:read' ]
provider: Pimcore\Bundle\StudioApiBundle\State\UserProvider
normalizationContext:
groups: [ 'get' ]
denormalizationContext:
Expand Down
14 changes: 14 additions & 0 deletions config/pimcore/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
api_platform:
title: 'Pimcore Studio API'
description: 'API for Pimcore Studio UI'
version: 0.0.1
graphql:
graphql_playground: false
graphiql:
enabled: false
event_listeners_backward_compatibility_layer: false
keep_legacy_inflector: false
enable_docs: true
enable_entrypoint: false
enable_swagger_ui: false
enable_re_doc: false
6 changes: 3 additions & 3 deletions config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api
resource: .
type: api_platform
prefix: /api
34 changes: 2 additions & 32 deletions config/serialization/asset.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,18 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
attributes:
id:
groups: ['asset:read']
parentId:
groups: ['asset:read']
permissions:
groups: [ 'asset:read' ]
type:
groups: ['asset:read']
children:
groups: ['asset:read']
filename:
groups: ['asset:read']
path:
groups: ['asset:read']
mimetype:
groups: ['asset:read']
creationDate:
groups: ['asset:read']
modificationDate:
groups: ['asset:read']
userOwner:
groups: ['asset:read']
userModification:
groups: ['asset:read']
properties:
groups: ['asset:item:get']
versions:
groups: ['asset:read']
metadata:
groups: ['asset:read']
locked:
groups: ['asset:read']
lock:
groups: ['asset:read']
customSettings:
groups: ['asset:item:get']
hasMetaData:
groups: ['asset:read']
dependencies:
groups: ['asset:item:get']
scheduledTasks:
groups: ['asset:item:get']
versionCount:
groups: ['asset:item:get']
fullPath:
groups: ['asset:read']
userPermissions:
groups: ['asset:read']
6 changes: 6 additions & 0 deletions config/serialization/asset/document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Document:
attributes:
pageCount:
groups: ['document:read', 'asset:read']
imageThumbnailPath:
groups: ['document:read', 'asset:read']
26 changes: 15 additions & 11 deletions config/serialization/asset/image.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Image:
attributes:
thumbnail:
groups: ['image:read']
groups: ['image:read', 'asset:read']
format:
groups: ['image:read']
groups: ['image:read', 'asset:read']
dimensions:
groups: ['image:read']
groups: ['image:read', 'asset:read']
width:
groups: ['image:read']
groups: ['image:read', 'asset:read']
height:
groups: ['image:read']
groups: ['image:read', 'asset:read']
animated:
groups: ['image:read']
groups: ['image:read', 'asset:read']
vectorGraphic:
groups: ['image:read']
lowQualityPreviewDataUri:
groups: ['image:read']
lowQualityPreviewPath:
groups: ['image:read']
groups: ['image:read', 'asset:read']
# lowQualityPreviewDataUri:
# groups: ['image:read']
# lowQualityPreviewPath:
# groups: ['image:read']
# iPTCData:
# groups: ['image:read']
# xMPData:
# groups: ['image:read']
10 changes: 10 additions & 0 deletions config/serialization/asset/metaData.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\MetaData:
attributes:
name:
groups: [ 'asset:read' ]
language:
groups: [ 'asset:read' ]
type:
groups: [ 'asset:read' ]
data:
groups: [ 'asset:read' ]
10 changes: 10 additions & 0 deletions config/serialization/asset/video.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Video:
attributes:
duration:
groups: ['video:read', 'asset:read']
width:
groups: ['video:read', 'asset:read']
height:
groups: ['video:read', 'asset:read']
imageThumbnailPath:
groups: ['video:read', 'asset:read']
2 changes: 1 addition & 1 deletion config/serialization/dependency.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pimcore\Model\Dependency:
Pimcore\Bundle\StudioApiBundle\Dto\Dependency:
attributes:
sourceId:
groups: ['dependency:read']
Expand Down
36 changes: 36 additions & 0 deletions config/serialization/element.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Pimcore\Bundle\StudioApiBundle\Dto\Element:
attributes:
id:
groups: ['element:read']
parentId:
groups: ['element:read']
permissions:
groups: ['element:read']
path:
groups: ['element:read']
creationDate:
groups: ['element:read']
modificationDate:
groups: ['element:read']
userOwner:
groups: ['element:read']
userModification:
groups: ['element:read']
properties:
groups: ['element:item:get']
versions:
groups: ['element:read']
locked:
groups: ['element:read']
lock:
groups: ['element:read']
dependencies:
groups: ['element:item:get']
scheduledTasks:
groups: ['element:item:get']
versionCount:
groups: ['element:item:get']
fullPath:
groups: ['element:read']
userPermissions:
groups: ['element:read']
7 changes: 6 additions & 1 deletion config/serialization/user.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Pimcore\Bundle\StudioApiBundle\Dto\ResetPasswordRequest:
attributes:
username:
groups: ['get', 'set']
groups: ['get', 'set']

Pimcore\Bundle\StudioApiBundle\Dto\User:
attributes:
id:
groups: ['user:read']
28 changes: 14 additions & 14 deletions config/serialization/version.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
Pimcore\Bundle\StudioApiBundle\Dto\Version:
attributes:
id:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
cid:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
ctype:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
userId:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
user:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
note:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
date:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
data:
groups: ['version:read']
public:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
serialized:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
versionCount:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
binaryFileHash:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
binaryFileId:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
autosave:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
storageType:
groups: ['version:read', 'asset:item:get']
groups: ['version:read', 'element:item:get']
46 changes: 42 additions & 4 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:

# Providers
Pimcore\Bundle\StudioApiBundle\State\AssetProvider: ~
Pimcore\Bundle\StudioApiBundle\State\UserProvider: ~
Pimcore\Bundle\StudioApiBundle\State\ScheduledTaskProvider: ~
Pimcore\Bundle\StudioApiBundle\State\VersionProvider: ~

Expand All @@ -31,7 +32,44 @@ services:
Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter:
tags: [ 'api_platform.filter' ]

# Normalizers
Pimcore\Bundle\StudioApiBundle\Serializer\AssetNormalizer:
tags:
- { name: 'serializer.normalizer' }
Pimcore\Bundle\StudioApiBundle\Filter\AssetIdSearchFilter:
tags: [ 'api_platform.filter' ]

# Hydrators
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\ArchiveHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\ArchiveHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\AudioHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\AudioHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\DocumentHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\DocumentHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\FolderHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\FolderHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\ImageHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\ImageHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\TextHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\TextHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\UnknownHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\UnknownHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\VideoHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\VideoHydrator
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\MetaDataHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\Asset\MetaDataHydrator

Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\AssetHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\AssetHydrator

Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\PermissionsHydratorInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\PermissionsHydrator

# Services
Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\AssetHydratorServiceInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\Hydrator\AssetHydratorService

Pimcore\Bundle\StudioApiBundle\Service\AssetSearchServiceInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\AssetSearchService

Pimcore\Bundle\StudioApiBundle\Service\GenericData\AssetSearchAdapterInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1\AssetSearchAdapter

Pimcore\Bundle\StudioApiBundle\Service\IconServiceInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\IconService
Loading

0 comments on commit 2558c3a

Please sign in to comment.