Skip to content

PS-1150 builtin attributes api#804

Open
4rthem wants to merge 18 commits into
masterfrom
PS-1150-builtin-attrs-api
Open

PS-1150 builtin attributes api#804
4rthem wants to merge 18 commits into
masterfrom
PS-1150-builtin-attrs-api

Conversation

@4rthem
Copy link
Copy Markdown
Member

@4rthem 4rthem commented May 13, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a backend-driven “built-in fields” catalog (API resource + provider) and updates the databox client to consume it instead of hardcoding built-in attribute definitions, while also renaming the client-side built-in field enum for clarity.

Changes:

  • Added a new API resource (/built-in-fields) backed by BuiltInFieldRegistry, plus translations for built-in field display names.
  • Refactored backend built-in-field interface to use static getName() and added metadata (isSearchable, isMultiple, isListed) surfaced through the new API.
  • Updated the client attribute-definition store and multiple search/profile UI components to use the new API response and the renamed BuiltInFieldEnum.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
databox/client/src/types.ts Adds client BuiltInField type and updates ProfileItem.key typing; imports new enum.
databox/client/src/store/attributeDefinitionStore.ts Replaces hardcoded built-in filters with getBuiltInFields() API call and adds built-in value resolver helper.
databox/client/src/hooks/useNotificationUriHandler.ts Switches to BuiltInFieldEnum for query building.
databox/client/src/components/Media/Search/Sorting/SortByRow.tsx Uses displayName for sorting row label rendering.
databox/client/src/components/Media/Search/Sorting/SortBy.tsx Updates store loading call signature (no t argument).
databox/client/src/components/Media/Search/Sorting/EditSortBy.tsx Switches to BuiltInFieldEnum and updates “score” handling.
databox/client/src/components/Media/Search/SortByChip.tsx Uses displayName for chip label rendering.
databox/client/src/components/Media/Search/SearchProvider.tsx Switches built-in field references to BuiltInFieldEnum.
databox/client/src/components/Media/Search/search.ts Renames built-in enum to BuiltInFieldEnum and updates default sort resolution.
databox/client/src/components/Media/Search/AQL/SearchConditions.tsx Updates store loading call signature (no t argument).
databox/client/src/components/Media/Search/AQL/SearchConditionDialog.tsx Updates store loading call signature (no t argument).
databox/client/src/components/Media/CollectionsPanel.tsx Switches to BuiltInFieldEnum for deleted filter.
databox/client/src/components/Media/Asset/Facets/facetWidgets.ts Switches to BuiltInFieldEnum for facet widget key mapping.
databox/client/src/components/Media/Asset/Attribute/Attributes.tsx Refactors built-in attribute rendering to use getBuiltInFieldValueResolver().
databox/client/src/components/Dialog/Profile/OrganizeProfile.tsx Updates store loading call signature (no t argument).
databox/client/src/api/types.ts Adds EntityName.BuiltInField.
databox/client/src/api/attributes.ts Adds getBuiltInFields() client API call.
databox/api/translations/messages.en.yaml Adds translation keys for built-in field display names.
databox/api/src/Model/BuiltInField.php New API Platform model representing a built-in field entry.
databox/api/src/Api/Provider/BuiltInFieldProvider.php New provider exposing built-in fields collection from registry.
databox/api/src/Elasticsearch/Mapping/FieldNameResolver.php Uses BuiltInFieldInterface::getName() for built-in ES field resolution.
databox/api/src/Elasticsearch/FacetHandler.php Uses BuiltInFieldInterface::getName() for missing aggregation field selection.
databox/api/src/Elasticsearch/BuiltInField/BuiltInFieldInterface.php Updates interface (static getName) and adds metadata methods.
databox/api/src/Elasticsearch/BuiltInField/AbstractBuiltInField.php Provides defaults for new interface methods and updates facet building field name usage.
databox/api/src/Elasticsearch/BuiltInField/AbstractDateTimeBuiltInField.php Updates date histogram facet field name usage to static::getName().
databox/api/src/Elasticsearch/AQL/AQLToESQuery.php Uses built-in field getName() when resolving built-in field clusters.
databox/api/src/Attribute/Type/IdAttributeType.php New attribute type for IDs (non-locale-aware, no suggest).
databox/api/src/Elasticsearch/BuiltInField/CollectionBuiltInField.php Renames ES field accessor to static getName() and marks as multiple.
databox/api/src/Elasticsearch/BuiltInField/CreatedAtBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/DeletedBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/EditedAtBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/IdBuiltInField.php Renames ES field accessor to static getName(); switches type to IdAttributeType.
databox/api/src/Elasticsearch/BuiltInField/IsStoryBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/OwnerBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/PrivacyBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/RenditionBuiltInField.php Renames ES field accessor to static getName() and marks as multiple.
databox/api/src/Elasticsearch/BuiltInField/ScoreBuiltInField.php Renames ES field accessor to static getName().
databox/api/src/Elasticsearch/BuiltInField/StoryBuiltInField.php Renames ES field accessor to static getName() and marks as multiple.
databox/api/src/Elasticsearch/BuiltInField/TagBuiltInField.php Renames ES field accessor to static getName() and marks as multiple.
databox/api/src/Elasticsearch/BuiltInField/WorkspaceBuiltInField.php Renames ES field accessor to static getName().
Comments suppressed due to low confidence (2)

databox/client/src/store/attributeDefinitionStore.ts:176

  • BuiltInFieldEnum.FileName is currently resolved to asset.createdAt, which is unrelated to the file name. This will display incorrect data when the File Name built-in field is used. Update the resolver to return the appropriate field (e.g., the asset name / source filename as represented in the client Asset model).
    databox/client/src/store/attributeDefinitionStore.ts:186
  • There is a very large block of commented-out legacy built-in-field definitions (with TODOs) below getBuiltInFieldValueResolver(). This makes the file harder to maintain and can easily drift out of date. Please remove it (or move the remaining TODOs into an issue/tracking ticket) now that built-in fields are being sourced from the API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread databox/client/src/types.ts
Comment thread databox/client/src/types.ts Outdated
Comment thread databox/client/src/store/attributeDefinitionStore.ts Outdated
Comment thread databox/client/src/components/Media/Asset/Attribute/Attributes.tsx
Comment thread databox/api/src/Attribute/Type/IdAttributeType.php Outdated
Comment thread databox/api/src/Api/Provider/BuiltInFieldProvider.php Outdated
Comment thread databox/api/src/Api/Provider/BuiltInFieldProvider.php Outdated
4rthem added 7 commits May 18, 2026 15:15
# Conflicts:
#	databox/api/src/Api/OutputTransformer/AssetOutputTransformer.php
#	databox/api/src/Attribute/BatchAttributeManager.php
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 126 out of 127 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

databox/client/src/components/Media/Search/search.ts:15

  • BuiltInFieldEnum still exposes FileMimeType = '@mimetype', but there is no corresponding built-in attribute implementation in the API registry anymore. This can mislead users into building AQL queries that will now fail with "Built-in field not found". Either reintroduce a @mimetype built-in attribute (and ES mapping) or remove/deprecate this enum value and any related UI/translation keys.

Comment thread lib/php/auth-bundle/Security/Traits/SecurityAwareTrait.php
Comment thread databox/api/src/Elasticsearch/BuiltInField/OwnerBuiltInField.php
Comment thread databox/api/src/Elasticsearch/BuiltInField/FileSizeBuiltInField.php
Comment thread databox/client/src/store/attributeDefinitionStore.ts
@4rthem 4rthem changed the title PS-1150 builtin attrs api PS-1150 builtin attributes api May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants