Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Relationship Field] : Expose REST Endpoint that returns fields that meet specific criteria #30796

Closed
Tracked by #30495
jcastro-dotcms opened this issue Nov 27, 2024 · 2 comments · Fixed by #30845
Closed
Tracked by #30495

Comments

@jcastro-dotcms
Copy link
Contributor

jcastro-dotcms commented Nov 27, 2024

Parent Issue

User Story

As a dotCMS developer, I want to be able to retrieve Fields from a Content Type that meet a specific list of criteria, so I can display the appropriate fields in the UI for Content Authors to deal with them. Such criteria can be related to can be, but not restricted to:

  • Required
  • User Searchable
  • System Indexed
  • Show in List
  • Unique

Acceptance Criteria

For this particular case, we need to be able to return all fields from a Content Type that are flagged as User Searchable.

However, in order to make this more generic, the new method in the REST Endpoint allows you to filter -- for the time being -- for fields that match the current 5 common attributes in a Field:

  • Required.
  • User Searchable.
  • System Indexed.
  • Show in List.
  • Unique.

So, a GET request to the Endpoint looking for fields in a given Content Type with all of those options checked would look like this:

{{serverURL}}/api/v3/contenttype/{{typeIdOrInode}}/fields/allfields?filter=REQUIRED&filter=USER_SEARCHABLE&filter=SYSTEM_INDEXED&filter=SHOW_IN_LIST&filter=UNIQUE

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@jcastro-dotcms jcastro-dotcms moved this from New to Current Sprint Backlog in dotCMS - Product Planning Nov 27, 2024
@jcastro-dotcms jcastro-dotcms moved this from Current Sprint Backlog to Next 1-3 Sprints in dotCMS - Product Planning Nov 27, 2024
@jcastro-dotcms jcastro-dotcms changed the title [Relationship Field] : Expose REST Endpoint that returns that meet specific attributes [Relationship Field] : Expose REST Endpoint that returns fields that meet specific criteria Nov 28, 2024
@jcastro-dotcms jcastro-dotcms self-assigned this Dec 3, 2024
@jcastro-dotcms jcastro-dotcms moved this from Next 1-3 Sprints to In Progress in dotCMS - Product Planning Dec 3, 2024
jcastro-dotcms added a commit that referenced this issue Dec 3, 2024
…at returns fields that meet specific criteria
@jcastro-dotcms jcastro-dotcms moved this from In Progress to In Review in dotCMS - Product Planning Dec 3, 2024
github-merge-queue bot pushed a commit that referenced this issue Dec 5, 2024
…at returns fields that meet specific criteria (#30845)

### Proposed Changes
* Exposes a new method in the Field Resource REST Endpoint that allows
you to filter Fields in a Content Type based on specific attributes,
such as:
  * Required.
  * User Searchable.
  * System Indexed.
  * Show in List.
  * Unique.
* This approach uses the `Specification Pattern`, which is a behavioral
design pattern often used to encapsulate filtering logic. The base of
this code can be re-used for filtering other objects too, it's not tied
to field filtering at all.
* New tests for the Postman suite have been added as well.
@jcastro-dotcms jcastro-dotcms moved this from In Review to Internal QA in dotCMS - Product Planning Dec 5, 2024
@jcastro-dotcms jcastro-dotcms removed their assignment Dec 5, 2024
@nicobytes nicobytes self-assigned this Dec 6, 2024
@nicobytes
Copy link
Contributor

QA Notes:

I’ve created a content type with fields using the options to filter.

Screenshot 2024-12-09 at 10 49 22 AM

My tests:

REQUIRED: 3 fields ✅

Screenshot 2024-12-09 at 10 51 38 AM

USER_SEARCHABLE: 2 fields ✅

Screenshot 2024-12-09 at 10 52 23 AM

SYSTEM_INDEXED: 7 fields ✅

Screenshot 2024-12-09 at 10 53 00 AM

SHOW_IN_LIST: 2 fields ✅

Screenshot 2024-12-09 at 10 53 44 AM

UNIQUE: 1 fields ✅

Screenshot 2024-12-09 at 10 54 10 AM

As a suggestion, each field should have a fieldType attribute.

@nicobytes nicobytes moved this from Internal QA to QA - Backlog in dotCMS - Product Planning Dec 9, 2024
@dsilvam dsilvam moved this from QA - Backlog to Done in dotCMS - Product Planning Dec 11, 2024
@dsilvam dsilvam closed this as completed Dec 11, 2024
@github-project-automation github-project-automation bot moved this from Done to Internal QA in dotCMS - Product Planning Dec 11, 2024
@dsilvam dsilvam moved this from Internal QA to Done in dotCMS - Product Planning Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment