dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
864 stars 468 forks source link

Create API/Factory methods to insert in the unique_fields table #30277

Open freddyDOTCMS opened 4 weeks ago

freddyDOTCMS commented 4 weeks ago

Parent Issue

29459

User Story

We need to create API and Factory methods to insert a record into the new unique_factory table:

This method should take the unique_key and the JSON for the supporting_values, this JSON can be pass like a Map. It will insert a new record. If an exception occurs due to a unique primary key (PK) violation, the method should allow the exception to propagate without handling it.

API Method:

This method should accept all the unqiue Criteria: Content Type ID, FIeld variable name, Host id, language Id, Field value, and content identifier. It must also check the value of the uniquePerSite field to determine how to calculate the hash. If uniquePerSite is true, the host_id must be included in the hash calculation. If a unique PK violation occurs, it should wrap the error in a custom exception.

AFter calculate the unique field key it must use the Factory method to save the new unique register.

Acceptance Criteria

API/Factory methods implemented

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

github-actions[bot] commented 1 week ago

PRs:

freddyDOTCMS commented 5 days ago

Note to QA: test together with #30279

jcastro-dotcms commented 3 days ago

As @freddyDOTCMS pointed out, this fix is not verifiable per se. It is validated after testing this related ticket:

Such a ticket passed IQA, which means this one did as well.